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

重庆网站开发培训机构可牛在线制作图片

重庆网站开发培训机构,可牛在线制作图片,网页设计建立站点实验报告,大连网站制作赞ls15227Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释#xff0c;可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili ItemObject_Trigger.cs using System.Collections; using System.Collecti…Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili ItemObject_Trigger.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class ItemObject_Trigger : MonoBehaviour {private ItemObject myItemObject GetComponentInParentItemObject();private void OnTriggerEnter2D(Collider2D collision){if (collision.GetComponentPlayer() ! null){myItemObject.PickupItem();}} }ItemObject.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class ItemObject : MonoBehaviour {private SpriteRenderer sr;[SerializeField] private Rigidbody2D rb;//设置速度[SerializeField] private ItemData ItemData;[SerializeField] private Vector2 velocity;//设置速度private void SetupVisuals(){if (ItemData null)return;GetComponentSpriteRenderer().sprite ItemData.icon;gameObject.name ItemData.name;}public void SetupItem(ItemData _itemData,Vector2 _velocity)设置实例函数{ItemData _itemData;rb.velocity _velocity;//设置速度SetupVisuals();}public void PickupItem()//拾取函数打包{Inventory.instance.AddItem(ItemData);Destroy(gameObject);} }ItemDrop.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements;public class ItemDrop : MonoBehaviour {[SerializeField] private int possibleItemDrop;//设置可能会出现的材料数量[SerializeField] private ItemData[] possibleDrop;private ListItemData dropList new ListItemData();[SerializeField] private GameObject dropPrefab;[SerializeField] private ItemData item;public void GenerateDrop()//随机生成物品函数{for(int i 0;ipossibleDrop.Length;i)//一个判断可能出现的装备{if(Random.Range(0,100) possibleDrop[i].dropChance){dropList.Add(possibleDrop[i]);} }for (int i 0; i possibleItemDrop; i)//另一个生成可能出现的装备{ItemData randomItem dropList[Random.Range(0, dropList.Count - 1)];if(possibleItemDrop dropList.Count ){dropList.Remove(randomItem);}DropItem(randomItem);}}public void DropItem(ItemData _itemData)//创建实例函数{GameObject newDrop Instantiate(dropPrefab, transform.position,Quaternion.identity);Vector2 randomVelocity new Vector2(Random.Range(-5, 5), Random.Range(15, 20));newDrop.GetComponentItemObject().SetupItem(_itemData, randomVelocity);} }EnemyStats.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.WSA;public class EnemyStat : CharacterStats {private Enemy enemy;private ItemDrop myDropSystem;[Header(Level details)][SerializeField] private int leval 1;[Range(0f, 1f)]//一个使数值设置成为一定范围的设置[SerializeField] private float percantageModifier .4f;//设置等级和成长比例public override void DoDamage(CharacterStats _targetStats){base.DoDamage(_targetStats);}protected override void Die(){base.Die();enemy.Die();myDropSystem.GenerateDrop();}protected override void Start(){//改变伤害和生命值//解决初始血量在升级后不满ApplyLevelModifier();enemy GetComponentEnemy();base.Start();myDropSystem GetComponentItemDrop();}private void ApplyLevelModifier(){Modify(strength);Modify(agility);Modify(intelligence);Modify(vitality);Modify(damage);Modify(critChance);Modify(critPower);Modify(maxHealth);Modify(armor);Modify(evasion);Modify(magicResistance);Modify(fireDamage);Modify(iceDamage);Modify(lightingDamage);}//专门对某个数值进行提升的函数private void Modify(Stat _stat){for(int i 1;ileval;i){float modifier _stat.GetValue() * percantageModifier;_stat.AddModifier(Mathf.RoundToInt(modifier));}}public override void TakeDamage(int _damage){base.TakeDamage(_damage);} }ItemData.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public enum ItemType {Material,Equipment }[CreateAssetMenu(fileName New Item Data, menuName Data/Item)] public class ItemData : ScriptableObject {public ItemType itemType;public string itemName;public Sprite icon;//图标[Range(0,100)]public float dropChance; }
http://www.hkea.cn/news/14448716/

相关文章:

  • 上海优化网站公司注册50万和100万
  • 产品外观工业设计公司安阳专业seo地址
  • 网站建设商城网站建设属于什么岗位
  • 网站服务器无响应是怎么回事带佣金的旅游推广平台有哪些
  • 西安网站建设公司哪有温州网站制作建设
  • 招聘销售员网站建设网络推广适合中小企业的管理软件
  • 手机设计logo软件重庆官网seo分析
  • 物业公司网站建设策划书mooc网站开发案例
  • 免费个人网站怎么建立整体vi设计方案
  • 做头像的网站空白西宁集团网站建设
  • 西安做网站魔盒沈阳市城市建设管理局网站
  • yandex推广seo推广一个月见效
  • 光泽县规划建设局网站如何提高网站收录
  • 中国建设银行员工网站wordpress 更改首页
  • 可直接进入正能量网站ui设计概念定义
  • 网站建设从零开始公众号注册
  • 手机网站制作wordpress分类信息模板下载
  • sql server网站建设制作游戏网站
  • 网站流量很少站长之家whois
  • 做网站的硬件和软件环境上海抖音推广公司
  • 张家港外贸网站设计wordpress 删除版权
  • 徐州建设网站设计图片欣赏
  • 辽阳高端网站建设公司百度关键词挖掘
  • 惠州手机模板建站深圳市seo网站设计哪家好
  • 如何自主建设企业网站购物网站建设策划书
  • 满城区城乡建设局网站东莞营销策划推广公司
  • 无忧中英繁企业网站系统 完整今天头条新闻
  • 中小企业网站建设咨询营销型网站seo
  • 成都电子商务网站建设手机优化加速有什么用
  • 网站部署到服务器活动推广宣传方案