Unity类银河恶魔城学习记录9-7 p88 Crystal instead of Clone源代码
Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考
此代码仅为较上一P有所改变的代码
【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili
Blackhole_Skill_Controller.cs
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;public class Blackhole_Skill_Controller : MonoBehaviour
{[SerializeField] private GameObject hotKeyPrefab;[SerializeField] private List<KeyCode> KeyCodeList;private float maxSize;//最大尺寸private float growSpeed;//变大速度private float shrinkSpeed;//缩小速度private float blackholeTimer;private bool canGrow = true;//是否可以变大private bool canShrink;//缩小private bool canCreateHotKeys = true;专门控制后面进入的没法生成热键private bool cloneAttackReleased;private bool playerCanDisaper = true;private int amountOfAttacks = 4;private float cloneAttackCooldown = .3f;private float cloneAttackTimer;private List<Transform> targets = new List<Transform>();private List<GameObject> createdHotKey = new List<GameObject>();public bool playerCanExitState { get; private set; }public void SetupBlackhole(float _maxSize,float _growSpeed,float _shrinkSpeed,int _amountOfAttacks,float _cloneAttackCooldown,float _blackholeDuration){maxSize = _maxSize;growSpeed = _growSpeed;shrinkSpeed = _shrinkSpeed;amountOfAttacks = _amountOfAttacks;cloneAttackCooldown = _cloneAttackCooldown;blackholeTimer = _blackholeDuration;if (SkillManager.instance.clone.crystalInsteadOfClone)//释放水晶时角色不消失playerCanDisaper = false;}private void Update(){blackholeTimer -= Time.deltaTime;cloneAttackTimer -= Time.deltaTime;if(blackholeTimer <= 0){blackholeTimer = Mathf.Infinity;//防止重复检测if (targets.Count > 0)//只有有target才释放攻击{ReleaseCloneAttack();//释放攻击}elseFinishBlackholeAbility();//缩小黑洞}if (Input.GetKeyDown(KeyCode.R)&& targets.Count > 0){ReleaseCloneAttack();}CloneAttackLogic();if (canGrow && !canShrink){//这是控制物体大小的参数transform.localScale = Vector2.Lerp(transform.localScale, new Vector2(maxSize, maxSize), growSpeed * Time.deltaTime);//类似MoveToward,不过是放大到多少大小 https://docs.unity3d.com/cn/current/ScriptReference/Vector2.Lerp.html}if (canShrink){transform.localScale = Vector2.Lerp(transform.localScale, new Vector2(0, 0), shrinkSpeed * Time.deltaTime);if (transform.localScale.x <= 1f){Destroy(gameObject);}}}//释放技能private void ReleaseCloneAttack(){cloneAttackReleased = true;canCreateHotKeys = false;DestroyHotKeys();if(playerCanDisaper){playerCanDisaper = false;PlayerManager.instance.player.MakeTransprent(true);}}private void CloneAttackLogic(){if (cloneAttackTimer < 0 && cloneAttackReleased&&amountOfAttacks>0){cloneAttackTimer = cloneAttackCooldown;int randomIndex = Random.Range(0, targets.Count);//限制攻击次数和设置攻击偏移量float _offset;if (Random.Range(0, 100) > 50)_offset = 1.5f;else_offset = -1.5f;if (SkillManager.instance.clone.crystalInsteadOfClone){SkillManager.instance.crystal.CreateCrystal(); //让生成克隆变成生成水晶SkillManager.instance.crystal.CurrentCrystalChooseRandomTarget(); //让黑洞里替换出来的水晶能够随机选择目标}else{SkillManager.instance.clone.CreateClone(targets[randomIndex], new Vector3(_offset, 0, 0));}amountOfAttacks--;if (amountOfAttacks <= 0){Invoke("FinishBlackholeAbility", 0.5f);}}}//完成黑洞技能后private void FinishBlackholeAbility(){DestroyHotKeys();canShrink = true;cloneAttackReleased = false;playerCanExitState = true;}private void OnTriggerEnter2D(Collider2D collision){if(collision.GetComponent<Enemy>()!=null){collision.GetComponent<Enemy>().FreezeTime(true);CreateHotKey(collision);}}private void OnTriggerExit2D(Collider2D collision){if (collision.GetComponent<Enemy>() != null){collision.GetComponent<Enemy>().FreezeTime(false);}}//创建QTE函数private void CreateHotKey(Collider2D collision){if(KeyCodeList.Count == 0)//当所有的KeyCode都被去除,就不在创建实例{return;}if(!canCreateHotKeys)//这是当角色已经开大了,不在创建实例{return;}//创建实例GameObject newHotKey = Instantiate(hotKeyPrefab, collision.transform.position + new Vector3(0, 2), Quaternion.identity);//将实例添加进列表createdHotKey.Add(newHotKey);//随机KeyCode传给HotKey,并且传过去一个毁掉一个KeyCode choosenKey = KeyCodeList[Random.Range(0, KeyCodeList.Count)];KeyCodeList.Remove(choosenKey);Blackhole_Hotkey_Controller newHotKeyScript = newHotKey.GetComponent<Blackhole_Hotkey_Controller>();newHotKeyScript.SetupHotKey(choosenKey, collision.transform, this);}//添加点击hotkey后对应的敌人进入敌人列表public void AddEnemyToList(Transform _myEnemy){targets.Add(_myEnemy);}//销毁Hotkeyprivate void DestroyHotKeys(){if(createdHotKey.Count <= 0){return;}for (int i = 0; i < createdHotKey.Count; i++){Destroy(createdHotKey[i]); }}}
Blackhole_Skill.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Blackhole_Skill : Skill
{[SerializeField]private float maxSize;//最大尺寸[SerializeField] private float growSpeed;//变大速度[SerializeField] private float shrinkSpeed;//缩小速度[SerializeField] private GameObject blackholePrefab;[Space][SerializeField] private float blackholeDuration;[SerializeField] int amountOfAttacks = 4;[SerializeField] float cloneAttackCooldown = .3f;Blackhole_Skill_Controller currentBlackhole;public override bool CanUseSkill(){return base.CanUseSkill();}public override void UseSkill(){base.UseSkill();GameObject newBlackhole = Instantiate(blackholePrefab,player.transform.position,Quaternion.identity);currentBlackhole = newBlackhole.GetComponent<Blackhole_Skill_Controller>();currentBlackhole.SetupBlackhole(maxSize,growSpeed,shrinkSpeed,amountOfAttacks,cloneAttackCooldown,blackholeDuration);}protected override void Start(){base.Start();}protected override void Update(){base.Update();}public bool SkillCompleted(){if(currentBlackhole == null)return false;if (currentBlackhole.playerCanExitState){return true;}else{return false;}}//把随机敌人半径改成黑洞半径的一半就行public float GetBlackholeRadius(){return maxSize / 2;}
}
Clone_Skill.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Crystal_Skill : Skill
{[SerializeField] private GameObject crystalPrefab;[SerializeField] private float crystalDuration;using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Clone_Skill : Skill
{[Header("Clone Info")][SerializeField] private GameObject clonePrefab;//克隆原型[SerializeField] private float cloneDuration;//克隆持续时间[SerializeField] private bool canAttack;// 判断是否可以攻击[SerializeField] private bool createCloneOnDashStart;[SerializeField] private bool createCloneOnDashOver;[SerializeField] private bool canCreateCloneOnCounterAttack;[Header("Clone can duplicate")][SerializeField] private bool canDuplicateClone;[SerializeField] private float chanceToDuplicate;[Header("Crystal instead of clone")]public bool crystalInsteadOfClone;public void CreateClone(Transform _clonePosition,Vector3 _offset)//传入克隆位置{if(crystalInsteadOfClone){SkillManager.instance.crystal.CreateCrystal();return;}//让所有的生成克隆的技能都变成生成水晶GameObject newClone = Instantiate(clonePrefab);//创建新的克隆//克隆 original 对象并返回克隆对象。//https://docs.unity3d.com/cn/current/ScriptReference/Object.Instantiate.htmlnewClone.GetComponent<Clone_Skill_Controller>().SetupClone(_clonePosition,cloneDuration,canAttack,_offset,FindClosestEnemy(newClone.transform),canDuplicateClone,chanceToDuplicate);//调试clone的位置,同时调试克隆持续时间 //Controller绑在克隆原型上的,所以用GetComponent }//让冲刺留下来的克隆在开始和结束各有一个public void CreateCloneOnDashStart(){if (createCloneOnDashStart)CreateClone(player.transform, Vector3.zero);}public void CreateCloneOnDashOver(){if(createCloneOnDashOver)CreateClone(player.transform, Vector3.zero);}//反击后产生一个克隆被刺敌人public void CanCreateCloneOnCounterAttack(Transform _enemyTransform){if (canCreateCloneOnCounterAttack)StartCoroutine(CreateCloneWithDelay(_enemyTransform, new Vector3(1 * player.facingDir, 0, 0)));}//整个延迟生成private IEnumerator CreateCloneWithDelay(Transform _enemyTransform, Vector3 _offset){yield return new WaitForSeconds(.4f);CreateClone(_enemyTransform, _offset);}
}private GameObject currentCrystal;[Header("Crystal mirage")][SerializeField] private bool cloneInsteadOfCrystal;[Header("Explosive crystal")][SerializeField] private bool canExplode;[Header("Moving crystal")][SerializeField] private bool canMoveToEnemy;[SerializeField] private float moveSpeed;[Header("Multi stacking crystal")][SerializeField] private bool canUseMultiStacks;[SerializeField] private int amountOfStacks;[SerializeField] private float multiStackCooldown;[SerializeField] private List<GameObject> crystalLeft = new List<GameObject>();//水晶列表[SerializeField] private float useTimeWindow;public override bool CanUseSkill(){return base.CanUseSkill();}public override void UseSkill(){base.UseSkill();if (CanUseMultiCrystal())return;if (currentCrystal == null){CreateCrystal();}else{//限制玩家在水晶可以移动时瞬移if (canMoveToEnemy)return;//爆炸前与角色交换位置Vector2 playerPos = player.transform.position;player.transform.position = currentCrystal.transform.position;currentCrystal.transform.position = playerPos;//水晶互换时在水晶处出现clone,水晶消失if (cloneInsteadOfCrystal){SkillManager.instance.clone.CreateClone(currentCrystal.transform,Vector3.zero);Destroy(currentCrystal);}else{currentCrystal.GetComponent<Crystal_Skill_Controller>()?.FinishCrystal();} }}public void CreateCrystal(){currentCrystal = Instantiate(crystalPrefab, player.transform.position, Quaternion.identity);Crystal_Skill_Controller currentCrystalScripts = currentCrystal.GetComponent<Crystal_Skill_Controller>();currentCrystalScripts.SetupCrystal(crystalDuration, canExplode, canMoveToEnemy, moveSpeed, FindClosestEnemy(currentCrystal.transform));}public void CurrentCrystalChooseRandomTarget() => currentCrystal.GetComponent<Crystal_Skill_Controller>().ChooseRandomEnemy();protected override void Start(){base.Start();}protected override void Update(){base.Update();}private bool CanUseMultiCrystal()//将List里的东西实例化函数{if(canUseMultiStacks){if(crystalLeft.Count > 0&&cooldownTimer<0){if(crystalLeft.Count == amountOfStacks){Invoke("ResetAbility", useTimeWindow);// 设置自动补充水晶函数}cooldown = 0;GameObject crystalToSpawn = crystalLeft[crystalLeft.Count - 1];GameObject newCrystal = Instantiate(crystalToSpawn, player.transform.position, Quaternion.identity);crystalLeft.Remove(crystalToSpawn);newCrystal.GetComponent<Crystal_Skill_Controller>().SetupCrystal(crystalDuration, canExplode, canMoveToEnemy, moveSpeed, FindClosestEnemy(newCrystal.transform));//当水晶发射完设置冷却时间和使用补充水晶if (crystalLeft.Count<=0){cooldown = multiStackCooldown;RefilCrystal();}}return true;}return false;}private void RefilCrystal()//给List填充Prefab函数{int amountToAdd = amountOfStacks - crystalLeft.Count;for (int i = 0;i < amountToAdd; i++){crystalLeft.Add(crystalPrefab);}}private void ResetAbility()//自动补充水晶函数{if (cooldownTimer > 0)return;cooldown = multiStackCooldown;RefilCrystal();}
}
Crystal_Skill_Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Crystal_Skill_Controller : MonoBehaviour
{private Animator anim => GetComponent<Animator>();private CircleCollider2D cd => GetComponent<CircleCollider2D>();private float crystalExitTimer;private bool canExplode;private bool canMove;private float moveSpeed;private bool canGrow;private float growSpeed = 5;private Transform closestTarget;[SerializeField] private LayerMask whatIsEnemy;public void SetupCrystal(float _crystalDuration,bool _canExplode,bool _canMove,float _moveSpeed,Transform _closestTarget){crystalExitTimer = _crystalDuration;canExplode = _canExplode;canMove = _canMove;moveSpeed = _moveSpeed;closestTarget = _closestTarget;}//让黑洞里替换出来的水晶能够随机选择目标public void ChooseRandomEnemy()//Ctrl里写函数,让最近敌人改成列表里的随机敌人{float radius = SkillManager.instance.blackhole.GetBlackholeRadius();//把随机敌人半径改成黑洞半径的一半就行Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, 50, whatIsEnemy);if(colliders.Length >= 0){closestTarget = colliders[Random.Range(0,colliders.Length)].transform;Debug.Log("Give Random");}}private void Update(){crystalExitTimer -= Time.deltaTime;if (crystalExitTimer < 0){FinishCrystal();}//可以运动就靠近敌人后爆炸,范围小于1时爆炸,并且爆炸时不能移动if (canMove){//修复攻击范围内没有敌人会报错的bugif(closestTarget != null){transform.position = Vector2.MoveTowards(transform.position, closestTarget.position, moveSpeed * Time.deltaTime);if (Vector2.Distance(transform.position, closestTarget.position) < 1){FinishCrystal();canMove = false;}}elsetransform.position = Vector2.MoveTowards(transform.position, transform.position+new Vector3(5,0,0), moveSpeed * Time.deltaTime);}//爆炸瞬间变大if (canGrow)transform.localScale = Vector2.Lerp(transform.localScale, new Vector2(3, 3), growSpeed * Time.deltaTime);}//爆炸造成伤害private void AnimationExplodeEvent(){Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, cd.radius);foreach(var hit in colliders){if (hit.GetComponent<Enemy>() != null)hit.GetComponent<Enemy>().Damage();}}public void FinishCrystal(){if (canExplode){canGrow = true;anim.SetBool("Explode",true);}else{SelfDestory();}}public void SelfDestory() => Destroy(gameObject);
}
Crystal_Skill
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Crystal_Skill : Skill
{[SerializeField] private GameObject crystalPrefab;[SerializeField] private float crystalDuration;private GameObject currentCrystal;[Header("Crystal mirage")][SerializeField] private bool cloneInsteadOfCrystal;[Header("Explosive crystal")][SerializeField] private bool canExplode;[Header("Moving crystal")][SerializeField] private bool canMoveToEnemy;[SerializeField] private float moveSpeed;[Header("Multi stacking crystal")][SerializeField] private bool canUseMultiStacks;[SerializeField] private int amountOfStacks;[SerializeField] private float multiStackCooldown;[SerializeField] private List<GameObject> crystalLeft = new List<GameObject>();//水晶列表[SerializeField] private float useTimeWindow;public override bool CanUseSkill(){return base.CanUseSkill();}public override void UseSkill(){base.UseSkill();if (CanUseMultiCrystal())return;if (currentCrystal == null){CreateCrystal();}else{//限制玩家在水晶可以移动时瞬移if (canMoveToEnemy)return;//爆炸前与角色交换位置Vector2 playerPos = player.transform.position;player.transform.position = currentCrystal.transform.position;currentCrystal.transform.position = playerPos;//水晶互换时在水晶处出现clone,水晶消失if (cloneInsteadOfCrystal){SkillManager.instance.clone.CreateClone(currentCrystal.transform,Vector3.zero);Destroy(currentCrystal);}else{currentCrystal.GetComponent<Crystal_Skill_Controller>()?.FinishCrystal();} }}public void CreateCrystal(){currentCrystal = Instantiate(crystalPrefab, player.transform.position, Quaternion.identity);Crystal_Skill_Controller currentCrystalScripts = currentCrystal.GetComponent<Crystal_Skill_Controller>();currentCrystalScripts.SetupCrystal(crystalDuration, canExplode, canMoveToEnemy, moveSpeed, FindClosestEnemy(currentCrystal.transform));}public void CurrentCrystalChooseRandomTarget() => currentCrystal.GetComponent<Crystal_Skill_Controller>().ChooseRandomEnemy();protected override void Start(){base.Start();}protected override void Update(){base.Update();}private bool CanUseMultiCrystal()//将List里的东西实例化函数{if(canUseMultiStacks){if(crystalLeft.Count > 0&&cooldownTimer<0){if(crystalLeft.Count == amountOfStacks){Invoke("ResetAbility", useTimeWindow);// 设置自动补充水晶函数}cooldown = 0;GameObject crystalToSpawn = crystalLeft[crystalLeft.Count - 1];GameObject newCrystal = Instantiate(crystalToSpawn, player.transform.position, Quaternion.identity);crystalLeft.Remove(crystalToSpawn);newCrystal.GetComponent<Crystal_Skill_Controller>().SetupCrystal(crystalDuration, canExplode, canMoveToEnemy, moveSpeed, FindClosestEnemy(newCrystal.transform));//当水晶发射完设置冷却时间和使用补充水晶if (crystalLeft.Count<=0){cooldown = multiStackCooldown;RefilCrystal();}}return true;}return false;}private void RefilCrystal()//给List填充Prefab函数{int amountToAdd = amountOfStacks - crystalLeft.Count;for (int i = 0;i < amountToAdd; i++){crystalLeft.Add(crystalPrefab);}}private void ResetAbility()//自动补充水晶函数{if (cooldownTimer > 0)return;cooldown = multiStackCooldown;RefilCrystal();}
}
相关文章:
Unity类银河恶魔城学习记录9-7 p88 Crystal instead of Clone源代码
Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili Blackhole_Skill_Controller.cs using System.Collections; using System…...
导出RWKV模型为onnx
测试模型: https://huggingface.co/RWKV/rwkv-5-world-3b 导出前对modeling_rwkv5.py进行一个修改: # out out.reshape(B * T, H * S) out out.reshape(B * T, H * S, 1) # <<--- modified out F.group_norm(out, nu…...
【LeetCode】整数转罗马数字 C语言 | 此刻,已成艺术(bushi)
Problem: 12. 整数转罗马数字 文章目录 思路解题方法复杂度Code 思路 暴力破解 转换 解题方法 由思路可知 复杂度 时间复杂度: O ( n ) O(n) O(n) 空间复杂度: O ( 1 ) O(1) O(1) Code char* intToRoman(int num) {char *s (char*)malloc(sizeof(char)*4000), *p s;while(…...
移动App开发常见的三种模式:原生应用、H5移动应用、混合模式应用
引言 在移动应用市场的迅猛发展中,移动App开发正日益成为技术创新和用户体验提升的焦点。对于开发者而言,选择适合自己项目的开发模式成为至关重要的决策。本文将探究移动App开发的三种常见模式:原生应用、H5移动应用和混合模式应用。这三种…...
k8s Secret配置资源,ConfigMap 存储配置信资源管理详解
目录 一、Secret 概念 三种Secret类型 pod三种使用secret的方式 应用场景:凭据: 二、 示例 2.1、用kubectl create secret命令创建 Secret 创建Secret: 查看Secret列表: 描述Secret: 2.2、用 base64 编码&…...
POS 之 最终确定性
Gasper Casper 是一种能将特定区块更新为 最终确定 状态的机制,使网络的新加入者确信他们正在同步规范链。当区块链出现多个分叉时,分叉选择算法使用累计投票来确保节点可以轻松选择正确的分叉。 最终确定性 最终确定性是某些区块的属性,意味…...
Vue快速开发一个主页
前言 这里讲述我们如何快速利用Vue脚手架快速搭建一个主页。 页面布局 el-container / el-header / el-aside / el-main:https://element.eleme.cn/#/zh-CN/component/container <el-container><el-header style"background-color: #4c535a"…...
Java SE入门及基础(33)
final 修饰符 1. 应用范围 final 修饰符应该使用在类、变量以及方法上 2. final 修饰类 Note that you can also declare an entire class final. A class that is declared final cannot be subclassed. This is particularly useful, for example, when creating an imm…...
ChatGPT逐步进入留学圈但并不能解决留学规划的问题
2022 年底,一个能像人类一样对话的AI软件ChatGPT,在5天内突破一百万用户,风靡全球,如今用户已达1.8亿。 四个月后,ChatGPT进化为GPT4版本。该版本逻辑、数学推理能力卓越。拿留美标准化考试举例,GPT4能够在…...
WebGL之灯光使用解析
在使用灯光之前,首先我们需要了解,与定义更广泛的 OpenGL 不同,WebGL 并没有继承 OpenGL 中灯光的支持。所以你只能由自己完全得控制灯光。幸运得是,这也并不是很难,本文接下来就会介绍完成灯光的基础。 在 3D 空间中…...
【Spring云原生系列】SpringBoot+Spring Cloud Stream:消息驱动架构(MDA)解析,实现异步处理与解耦合
🎉🎉欢迎光临,终于等到你啦🎉🎉 🏅我是苏泽,一位对技术充满热情的探索者和分享者。🚀🚀 🌟持续更新的专栏《Spring 狂野之旅:从入门到入魔》 &a…...
PostgreSQL索引篇 | TSearch2 全文搜索
PostgreSQL版本为8.4.1 (本文为《PostgreSQL数据库内核分析》一书的总结笔记,需要电子版的可私信我) 索引篇: PostgreSQL索引篇 | BTreePostgreSQL索引篇 | GiST索引PostgreSQL索引篇 | Hash索引PostgreSQL索引篇 | GIN索引 (倒排…...
SpringMVC 中的常用注解和用法
⭐ 作者:小胡_不糊涂 🌱 作者主页:小胡_不糊涂的个人主页 📀 收录专栏:JavaEE 💖 持续更文,关注博主少走弯路,谢谢大家支持 💖 注解 1. MVC定义2. 注解2.1 RequestMappin…...
智慧城市中的数据力量:大数据与AI的应用
目录 一、引言 二、大数据与AI技术的融合 三、大数据与AI在智慧城市中的应用 1、智慧交通 2、智慧环保 3、智慧公共安全 4、智慧公共服务 四、大数据与AI在智慧城市中的价值 1、提高城市管理的效率和水平 2、优化城市资源的配置和利用 3、提升市民的生活质量和幸福感…...
德人合科技|天锐绿盾加密软件——数据防泄漏系统
德人合科技是一家专注于提供企业级信息安全解决方案的服务商,提供的天锐绿盾加密软件是一款专为企业设计的数据安全防护产品,主要用于解决企事业单位内部敏感数据的防泄密问题。 www.drhchina.com PC端: https://isite.baidu.com/site/wjz012…...
C语言---单身狗问题
1.单身狗初阶 这个题目就是数组里面有一串数字,都是成对存在的,只有一个数字只出现了一次,请你找出来 (1)异或是满足交换律的,两个相同的数字异或之后是0; (2)让0和每个…...
一次gitlab 502故障解决过程
通过top,发现prometheus进程占用CPU接近100%,这肯定有点异常。gitlab-ctl tail prometheus 发现有报错的情况,提示空间不足。暂时不管空间的问题。 2024-03-07_05:48:09.01515 ts2024-03-07T05:48:09.014Z callermain.go:1116 levelerror err"open…...
Xilinx 7系列 FPGA硬件知识系列(一)——FPGA选型参考
目录 1.1 Xilinx-7系列产品的工艺级别 编辑1.2 Xilinx-7系列产品的特点 1.2.1 Spartan-7系列 1.2.2 Artix-7系列 1.2.3 Kintex-7系列 1.2.4 Virtex-7系列 1.3 Xilinx-7系列FPGA对比 1.3.1 DSP资源柱状图 1.3.2 Block RAM资源柱状图 1.3.3 高速串行收…...
【C++从练气到飞升】02---初识类与对象
🎈个人主页:库库的里昂 ✨收录专栏:C从练气到飞升 🎉鸟欲高飞先振翅,人求上进先读书。 目录 ⛳️推荐 一、面向过程和面向对象初步认识 二、类的引用 1. C语言版 2. C版 三、类的定义 类的两种定义方式ÿ…...
探秘分布式神器RMI:原理、应用与前景分析(一)
本系列文章简介: 本系列文章将深入探究RMI远程调用的原理、应用及未来的发展趋势。首先,我们会详细介绍RMI的工作原理和基本流程,解析其在分布式系统中的核心技术。随后,我们将探讨RMI在各个领域的应用,包括分布式计算…...
MFC内存泄露
1、泄露代码示例 void X::SetApplicationBtn() {CMFCRibbonApplicationButton* pBtn GetApplicationButton();// 获取 Ribbon Bar 指针// 创建自定义按钮CCustomRibbonAppButton* pCustomButton new CCustomRibbonAppButton();pCustomButton->SetImage(IDB_BITMAP_Jdp26)…...
Swift 协议扩展精进之路:解决 CoreData 托管实体子类的类型不匹配问题(下)
概述 在 Swift 开发语言中,各位秃头小码农们可以充分利用语法本身所带来的便利去劈荆斩棘。我们还可以恣意利用泛型、协议关联类型和协议扩展来进一步简化和优化我们复杂的代码需求。 不过,在涉及到多个子类派生于基类进行多态模拟的场景下,…...
连锁超市冷库节能解决方案:如何实现超市降本增效
在连锁超市冷库运营中,高能耗、设备损耗快、人工管理低效等问题长期困扰企业。御控冷库节能解决方案通过智能控制化霜、按需化霜、实时监控、故障诊断、自动预警、远程控制开关六大核心技术,实现年省电费15%-60%,且不改动原有装备、安装快捷、…...
P3 QT项目----记事本(3.8)
3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...
04-初识css
一、css样式引入 1.1.内部样式 <div style"width: 100px;"></div>1.2.外部样式 1.2.1.外部样式1 <style>.aa {width: 100px;} </style> <div class"aa"></div>1.2.2.外部样式2 <!-- rel内表面引入的是style样…...
Spring AI 入门:Java 开发者的生成式 AI 实践之路
一、Spring AI 简介 在人工智能技术快速迭代的今天,Spring AI 作为 Spring 生态系统的新生力量,正在成为 Java 开发者拥抱生成式 AI 的最佳选择。该框架通过模块化设计实现了与主流 AI 服务(如 OpenAI、Anthropic)的无缝对接&…...
scikit-learn机器学习
# 同时添加如下代码, 这样每次环境(kernel)启动的时候只要运行下方代码即可: # Also add the following code, # so that every time the environment (kernel) starts, # just run the following code: import sys sys.path.append(/home/aistudio/external-libraries)机…...
Python Einops库:深度学习中的张量操作革命
Einops(爱因斯坦操作库)就像给张量操作戴上了一副"语义眼镜"——让你用人类能理解的方式告诉计算机如何操作多维数组。这个基于爱因斯坦求和约定的库,用类似自然语言的表达式替代了晦涩的API调用,彻底改变了深度学习工程…...
Vite中定义@软链接
在webpack中可以直接通过符号表示src路径,但是vite中默认不可以。 如何实现: vite中提供了resolve.alias:通过别名在指向一个具体的路径 在vite.config.js中 import { join } from pathexport default defineConfig({plugins: [vue()],//…...
STM32---外部32.768K晶振(LSE)无法起振问题
晶振是否起振主要就检查两个1、晶振与MCU是否兼容;2、晶振的负载电容是否匹配 目录 一、判断晶振与MCU是否兼容 二、判断负载电容是否匹配 1. 晶振负载电容(CL)与匹配电容(CL1、CL2)的关系 2. 如何选择 CL1 和 CL…...
