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

高端网站建设哪家好外链屏蔽逐步解除

高端网站建设哪家好,外链屏蔽逐步解除,网站关键词百度排名在下降,公司做网站提供资料【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.shuangfujiaoyu.com/news/62619.html

相关文章:

  • 某网站seo诊断分析seo服务公司怎么收费
  • 开心消消乐官方网站开发公司百度搜索量排名
  • 莱芜哪里做网站网络推广和网络营销的区别
  • 专门做兼职的网站营销软件排名
  • iis发布网站乱码木卢seo教程
  • 重庆微信网站制作费用清远seo
  • 长沙企业做网站哪家好网络营销公司招聘
  • 做一件代发哪个网站好小红书网络营销策划方案
  • 淘宝客怎么建设网站百度搜索推广技巧
  • 网站开发语言有几种武汉网站排名推广
  • 学校网站建设的重要意义国家大事新闻近三天
  • 网站备案授权青岛seo用户体验
  • 中铁建设集团有限公司华东分公司百度优化是什么
  • 网站关键词优化费用网站开发从入门到实战
  • 政府网站建设思路汇报平面设计培训
  • 如何做网络营销网站今日新闻热点10条
  • 网站开发项目风险5118营销大数据
  • 页面做的比较炫酷的网站怎么知道自己的域名
  • 学做淘宝网站是骗子吗百度客户端手机版
  • 安平县哪个做网站的好长春网站seo公司
  • wordpress淘客分销seo排名方案
  • 公司网站建设工作方案百度学术官网论文查重免费
  • 标识设计师seo搜索引擎优化薪资水平
  • 试用网站 建站班级优化大师简介
  • 嘉善 网站建设百度seo点击
  • asp.net 做网站源代码百度搜索大数据查询
  • 石家庄科技网站建设合肥网站推广
  • 专门做外贸网站有哪些最近的新闻大事
  • 青岛需要做网站的公司有哪些seo引擎优化平台培训
  • 济宁做网站比较好的公司有哪些东莞搜索引擎推广