当前位置: 首页 > news >正文

nas上建设网站设计师门户网站程序

nas上建设网站,设计师门户网站程序,系统开发流程8个步骤,网站设计的特点【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili 教程源地址:https://www.udemy.com/course/2d-rpg-alexdev/ 本章节实现了解锁技能后才可以使用技能,先完成了冲刺技能的锁定解锁 Dash_Skill.cs using System.Collections; using System…

【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili

教程源地址:https://www.udemy.com/course/2d-rpg-alexdev/

本章节实现了解锁技能后才可以使用技能,先完成了冲刺技能的锁定解锁

Dash_Skill.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//2024年11月19日添加解锁技能逻辑
public class Dash_Skill : Skill
{[Header("Dash")]public bool dashUnlocked;[SerializeField] private UI_SKillTreeSlot dashUnlockButton;[Header("Clone on dash")]public bool cloneOmDashUnlocked;[SerializeField] private UI_SKillTreeSlot cloneOnDashUnlockButton;[Header("Clone on arrival")]public bool cloneOnArrivalUnlocked;[SerializeField] private UI_SKillTreeSlot cloneOnArrivalUnlockButton;public override void UseSkill(){base.UseSkill();}protected override void Start(){base.Start();dashUnlockButton.GetComponent<Button>().onClick.AddListener(UnlockDash);cloneOnDashUnlockButton.GetComponent<Button>().onClick.AddListener(UnlockCloneOnDash);cloneOnArrivalUnlockButton.GetComponent<Button>().onClick.AddListener(UnlockCloneOnArrival);}private void UnlockDash(){if (dashUnlockButton.unlocked)   dashUnlocked = true;}private void UnlockCloneOnDash(){if (cloneOnDashUnlockButton.unlocked)cloneOmDashUnlocked = true;}private void UnlockCloneOnArrival(){if (cloneOnArrivalUnlockButton.unlocked)cloneOnArrivalUnlocked = true;}public void CloneOnDash(){if (cloneOmDashUnlocked)SkillManager.instance.clone.CreateClone(player.transform, Vector3.zero);}public void CloneOnArrival(){if (cloneOnArrivalUnlocked)SkillManager.instance.clone.CreateClone(player.transform, Vector3.zero);}}

UI_SKillTreeSlot .cs

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;//2024年11月17日
public class UI_SKillTreeSlot : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{private UI ui;private Image skillImage;//当前技能槽的图片组件[SerializeField] private int skillPirce;//技能价格[SerializeField] private string skillName;[TextArea][SerializeField] private string skillDescription;[SerializeField] private Color lockedSkillColor;//技能未解锁时的颜色public bool unlocked;[SerializeField] private UI_SKillTreeSlot[] shouldBeUnlocked;//解锁前置条件[SerializeField] private UI_SKillTreeSlot[] shouldBeLocked;//锁定条件private void OnValidate(){gameObject.name = "SkillTreeSlot_UI - " + skillName;}private void Awake(){GetComponent<Button>().onClick.AddListener(() => UnlockSkillSlot());//给 Button 组件绑定点击事件,用于触发技能槽解锁逻辑}private void Start(){skillImage = GetComponent<Image>();ui = GetComponentInParent<UI>();skillImage.color = lockedSkillColor;//设置初始颜色为锁定颜色}public void UnlockSkillSlot(){if(PlayerManager.instance.HaveEnoughMoney(skillPirce) == false)//检查是否有足够的钱return;for (int i = 0; i < shouldBeUnlocked.Length; i++)//前置解锁检查{if (shouldBeUnlocked[i].unlocked == false){Debug.Log("不能解锁技能");return;}}for (int i = 0; i < shouldBeLocked.Length; i++)//锁定检查{if (shouldBeLocked[i].unlocked == true){Debug.Log("不能解锁技能");return;}}unlocked = true;skillImage.color = Color.white;}public void OnPointerEnter(PointerEventData eventData){ui.skillToolTip.ShowToolTip(skillDescription, skillName);Vector2 mousePosition = Input.mousePosition;float xOffset = 0;float yOffset = 0;if (mousePosition.x > 600)xOffset = -150;elsexOffset = 150;//鼠标靠近屏幕右侧时,提示框向左偏移;否则向右偏移if (mousePosition.y > 320)yOffset = -150;elseyOffset = 150;//鼠标靠近屏幕顶部时,提示框向下偏移;否则向上偏移ui.skillToolTip.transform.position = new Vector2(mousePosition.x + xOffset, mousePosition.y + yOffset);//更新提示框位置为鼠标位置偏移后的点}public void OnPointerExit(PointerEventData eventData){ui.skillToolTip.HideToolTip();//鼠标离开槽位时,隐藏技能描述提示框}
}

PlayerManager.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;//P63,制作玩家管理器和技能管理器
//可以在SkeletonBattleState中通过PlayerManager.instance.player.transform获取到玩家的位置
public class PlayerManager : MonoBehaviour
{//全局访问public static PlayerManager instance;//单例模式public Player player;public int currency;private void Awake(){if (instance != null)Destroy(instance.gameObject);elseinstance = this;}public bool HaveEnoughMoney(int _price)//是否有钱去买技能{if (_price > currency){Debug.Log("没有足够的钱");return false;}elsecurrency -= _price;return true;}
}

Clone_Skill.cs

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 canCreateCloneOnCounterAttack;[Header("Clone can Duplicate")][SerializeField] private bool canDuplicateClone;//可以重复clone[SerializeField] private float chanceToDuplicate;//重复clone的几率[Header("Crystal instead of clone")]public bool crystalInsteadOfClone;//是否使用水晶代替克隆public void CreateClone(Transform _clonePosition,Vector3 _offset)//传入克隆位置{if(crystalInsteadOfClone)//克隆转换成水晶{SkillManager.instance.crystal.CreateCrystal();SkillManager.instance.crystal.CurrentCrystalChooseRandomTarget();return;}GameObject newClone = Instantiate(clonePrefab);//创建新的克隆//克隆 original 对象并返回克隆对象。newClone.GetComponent<Clone_Skill_Controller>().SetupClone(_clonePosition, cloneDuration, canAttack,_offset,FindClosesetEnemy(newClone.transform),canDuplicateClone, chanceToDuplicate,player);}public void CreateCloneOnCounterAttack(Transform _enemyTransform){if(canCreateCloneOnCounterAttack)StartCoroutine(CreateCloneWithDelay(_enemyTransform, new Vector3(2 * player.facingDir, 0)));}private IEnumerator CreateCloneWithDelay(Transform _transform,Vector3 _offset){yield return new WaitForSeconds(.4f);CreateClone(_transform, _offset);}}

http://www.yayakq.cn/news/627857/

相关文章:

  • 阿里云做网站选什么主机农业行业网站模板
  • 合肥网络推广外包seo是什么生肖
  • 免费网站开发框架淘宝客网站源码加各类插件
  • 学校网站建设申请html网页设计简单代码
  • 代做毕业设计网站多少钱如何做网站流程图
  • 安防网站建设做网站新闻
  • 建设门户网站申请报告wordpress显示大写
  • 俄语在线网站制作高端品牌优势
  • 宁德城乡建设部网站国内做会展比较好的公司
  • 未备案的网站宋祖儿在哪个网站做网红
  • 备案 网站 漏接 电话会做网站的公司
  • 论坛网站怎么推广wordpress改了固定链接访问不
  • 写作网站最大软件项目管理课程
  • 网站开发 制作网页版梦幻西游决战华山奖励
  • 农村办厂暴利项目成都网站seo外包
  • 国外优秀画册设计网站内蒙建设厅官方网站
  • 网站建设费入何科目做视频网站新手教学
  • 安庆信德建设咨询有限公司网站网站怎么做qq登录
  • 网站建设的描述桂林山水甲天下是哪个景点
  • 做智能家居网站需要的参考文献外国做动漫图片的网站叫什么名字
  • 中山企业网站推广公司wordpress 4.7.3 乱码
  • 百度知道在线网站seo与网站没关
  • 措美网站建设wordpress中php代码只能一行一行写
  • lol网站建设成都工业学院文献检索在哪个网站做
  • 烟台市牟平区建设局网站沈阳建设工程信息网 等级中项网
  • 盘锦网站建设价位商场网站建设
  • 制作logo网站外贸订单一般在哪个平台接?
  • 苏州网站建设网络wordpress编辑模板插件
  • 网站建设做什么费用做便民工具网站怎么样
  • 本地佛山顺德网站设计网站建设】