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

网站icp备案代理建立公司网站时什么是重要的

网站icp备案代理,建立公司网站时什么是重要的,防城港市网站建设,个人做公司网站本章项目成果展示 我们打开上一篇74穿戴装备的项目, 本章要做的事情是制作主角属性界面,实现在面板上显示主角的攻击力等数值 制作一个简易的主角界面(创建Image与Text显示即可) 创建一个空物体 重命名为PlayerInfo 在其子级下创…

本章项目成果展示

我们打开上一篇74穿戴装备的项目,

本章要做的事情是制作主角属性界面,实现在面板上显示主角的攻击力等数值

制作一个简易的主角界面(创建Image与Text显示即可)

创建一个空物体

重命名为PlayerInfo

在其子级下创建Text

重命名为AttackInfoText

设置文本组件

依次复制

重命名

创建脚本:

编写脚本:PlayerEquipInfoUI.cs

using UnityEngine;
using UnityEngine.UI; 
public class PlayerEquipInfoUI : MonoBehaviour{GameManager gm;Text hpText; void Start(){gm = GameManager.Instance;hpText = transform.Find("PlayerInfo/HpText").GetComponent<Text>();UpdateUI();}void Update(){UpdateUI();}void UpdateUI(){hpText.text = gm.infoSys.playerHP.ToString();}
}

运行后实现血量的恒定值显示

复写脚本:PlayerEquipInfoUI.cs

using UnityEngine;
using UnityEngine.UI; 
public class PlayerEquipInfoUI : MonoBehaviour{GameManager gm;Text hpText;Text mpText;Text attText;Text defText;void Start(){gm = GameManager.Instance;hpText = transform.Find("PlayerInfo/HpText").GetComponent<Text>();mpText = transform.Find("PlayerInfo/MpText").GetComponent<Text>();attText = transform.Find("PlayerInfo/AttackInfoText").GetComponent<Text>();defText = transform.Find("PlayerInfo/DefenseText").GetComponent<Text>();UpdateUI();}void Update(){UpdateUI();}void UpdateUI(){attText.text = gm.infoSys.attackValue.ToString();hpText.text = gm.infoSys.playerHP.ToString();mpText.text = gm.infoSys.playerMP.ToString();defText.text = gm.infoSys.defineValue.ToString();   }
}

运行项目

在UIMangaer.cs增加一个战斗力的字段

修改脚本:PlayerEquipInfoUI.cs

运行实现

接下来给主角属性面板增加一个按钮控制开关

复制一个按钮

修改脚本:UIManager.cs

修改扔到地面的报红

删除掉UISlot.cs脚本中的背包刷新代码

添加到打开背包BagExample.cs中

运行项目

接下来制作当穿上装备增加攻击力与战斗力以及数值变化的显示功能

创建Text文本重命名为EquipInfo

设置为隐藏

修改脚本:RightClickItem.cs

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class RightClickItem : MonoBehaviour, IPointerClickHandler{Image childImage;GameManager gm;GameObject currentCanvas;void Start(){gm = GameManager.Instance;childImage = transform.Find("Icon").GetComponent<Image>();currentCanvas = GameObject.Find("CurrentCanvas").gameObject;}public void OnPointerClick(PointerEventData eventData){if (eventData.button == PointerEventData.InputButton.Right){if (childImage.sprite != null && childImage.sprite.name == "sword_basic4_blue") {Transform weaponEquipPos = GameObject.FindGameObjectWithTag("WeaponEquipPos").transform;weaponEquipPos.gameObject.GetComponent<Image>().sprite = childImage.sprite;weaponEquipPos.gameObject.GetComponent<Image>().color = Color.white;weaponEquipPos.gameObject.transform.Find("Image").gameObject.SetActive(false);childImage.sprite = null;childImage.color = new Color(45f / 255f, 45f / 255f, 45f / 255f);childImage.GetComponent<RectTransform>().sizeDelta = new Vector2(90, 90);gm.infoSys.attackValue += 500;gm.infoSys.CombatValue += (int)(500 * 1.3f);currentCanvas.transform.Find("EquipInfo").GetComponent<Text>().color = Color.green;currentCanvas.transform.Find("EquipInfo").GetComponent<Text>().text = "战斗力上升" + (int)(500 * 1.3f);currentCanvas.transform.Find("EquipInfo").gameObject.SetActive(true);StartCoroutine(WaitForThreeEquipText());}}}IEnumerator WaitForThreeEquipText() {yield return new WaitForSeconds(2);currentCanvas.transform.Find("EquipInfo").gameObject.SetActive(false);}
}

运行项目 - 当穿戴装备时

修改脚本:RightClickWeaponBack.cs

using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class RightClickWeaponBack : MonoBehaviour, IPointerClickHandler{Image childImage;Sprite WeaponIconNormal;GameManager gm;GameObject currentCanvas;void Start(){gm = GameManager.Instance;WeaponIconNormal = Resources.Load<Sprite>("Prefabs/UGUIIcons/IndigoWeaponIcon_01");currentCanvas = GameObject.Find("CurrentCanvas").gameObject;}public void OnPointerClick(PointerEventData eventData){if (eventData.button == PointerEventData.InputButton.Right){if (transform.GetComponent<Image>().sprite == null)return;childImage = GameObject.FindWithTag("WeaponEquipPos").GetComponent<Image>();if (childImage.sprite != null){Transform uISlotPos = GameObject.FindGameObjectWithTag("UISlot").transform;if (uISlotPos.gameObject.GetComponent<Image>().sprite == null){uISlotPos.gameObject.GetComponent<Image>().sprite = childImage.sprite;uISlotPos.gameObject.GetComponent<Image>().color = Color.white;childImage.sprite = WeaponIconNormal;childImage.GetComponent<RectTransform>().sizeDelta = new Vector2(90, 90);gm.infoSys.attackValue -= 500;gm.infoSys.CombatValue -= (int)(500 * 1.3f);currentCanvas.transform.Find("EquipInfo").GetComponent<Text>().color = Color.red;currentCanvas.transform.Find("EquipInfo").GetComponent<Text>().text = "战斗力下降" + (int)(500 * 1.3f);currentCanvas.transform.Find("EquipInfo").gameObject.SetActive(true);StartCoroutine(WaitForThreeEquipText());}}}IEnumerator WaitForThreeEquipText(){yield return new WaitForSeconds(2);currentCanvas.transform.Find("EquipInfo").gameObject.SetActive(false);}}
}

运行项目 - 当脱下装备时

本章实现了主角属性界面的属性同步功能

接下来的文章内容:

1.3D模型动态投射UI

2.窗口可拖拽脚本

3.点击名称寻找地点功能

4.隐藏怪物的生成

5.怪物I攻击范围内的主动攻击

6.掉落坐骑蛋的获取

7.异步传送转换场景

以及开放回合制、坐骑系统、宠物系统、背包系统、神炼系统、商城系统、Boss的目标跟随任务导航系统以及UI播放3D动画效果等等。

具体项目运行效果请关注water1024的b站视频项目演示《破碎纪元》

【Unity回合2.5D】破碎纪元_单机游戏热门视频 (bilibili.com)icon-default.png?t=O83Ahttps://www.bilibili.com/video/BV1rZY4e9Ebs/?spm_id_from=333.999.0.0&vd_source=547091a95b03acfa8e8a9e46ef499cd6

 

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

相关文章:

  • 做公司网站页面wordpress博客有手机版
  • 免费网站程序建设工程的招标网站有哪些
  • 重庆网站建设川娃子大数据学出来做什么工作
  • 北京网站建设资讯连运港网络公司做网站
  • 网站美工培训机构美食攻略网站建设课程设计
  • 在线网站建设询问报价国际工程承包
  • 室内设计网站源码下载企业门户网站建设报价
  • 百度上怎么做网站wordpress火车头发布模块接口
  • 免费做网站软件下载石家庄商城网站制作
  • asp.net网站安装教程尚普咨询市场调研公司
  • 网站网站制作女与男做那个的视频网站
  • 常见cms网站源码下载图片怎么做网站背景
  • 旅游品牌推广方案深圳网站快速排名优化
  • 怎么建设网站页面天水网站建设公司
  • 专业北京网站建设公司排名西部数码如何建设自己的网站
  • 网站制作经费预算表2024舆情信息范例8篇
  • 网站分享功能怎么做搜索引擎优化叫什么
  • 保险网站有哪些保险网站免费移动版wordpress
  • 南京网站建设培训做炫光素材的网站
  • 一个人可以做几个网站负责人需要锦州网站建设
  • 成都高标建设有限公司官方网站wordpress主题后台管理
  • 最好的购物网站排名工程中标公示查询怎么查
  • 电商网站开发需要什么语言加强网站政务服务建设
  • 网站wap转换企业邮箱免费版开通
  • 网站改用绝对地址的好处专业做seo推广
  • 网站建设进度说明农产品的网站建设方案以及范文
  • 哪里可以做网站优化崇卅市网站建设
  • 网站二级目录怎么做301保定网站建设的过程
  • python网站开发教程永久免费个人网页申请
  • 国外浏览器网站网站建设注册什么公司好