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

有没有专业做steam创客的网站端点seo博客

有没有专业做steam创客的网站,端点seo博客,做网站页面视频教学,舞台地板Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili UI_itemSlot.cs using System.Collections; using System.Collections.Gen…

 Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考
此代码仅为较上一P有所改变的代码

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

UI_itemSlot.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;public class UI_itemSlot : MonoBehaviour
{[SerializeField] private Image itemImage;[SerializeField] private TextMeshProUGUI itemText;public InventoryItem item;public void UpdateSlots(InventoryItem _newItem){item = _newItem;itemImage.color = Color.white;if (item != null){itemImage.sprite = item.data.icon;if (item.stackSize > 1){itemText.text = item.stackSize.ToString();}else{itemText.text = "";}}}}
Inventory.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Inventory : MonoBehaviour
{public static Inventory instance;public List<InventoryItem> inventoryItems;//inventoryItems类型的列表public Dictionary<ItemData, InventoryItem> inventoryDictianory;//以ItemData为Key寻找InventoryItem的字典[Header("Inventory UI")][SerializeField] private Transform inventorySlotParent;private UI_itemSlot[] itemSlot;//UI Slot的数组private void Awake(){if (instance == null)instance = this;elseDestroy(gameObject);//防止多次创建Inventory}public void Start(){inventoryItems = new List<InventoryItem>();inventoryDictianory = new Dictionary<ItemData, InventoryItem>();itemSlot = inventorySlotParent.GetComponentsInChildren<UI_itemSlot>();//拿到的方式有点绕,显示拿到Canvas 里的 Inventory 然后通过GetComponentsInChildren拿到其下的使用UISlot}private void UpdateSlotUI(){for(int i = 0;i < inventoryItems.Count;i++ ){itemSlot[i].UpdateSlots(inventoryItems[i]);}}public void AddItem(ItemData _item)//将物体存入Inventory的函数{if(inventoryDictianory.TryGetValue(_item,out InventoryItem value)){value.AddStack();}//字典的使用,通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体,故调用else是为了初始化库存,使其中含有一个基本的值{InventoryItem newItem = new InventoryItem(_item);inventoryItems.Add(newItem);//填进列表里只有一次inventoryDictianory.Add(_item, newItem);//同上}UpdateSlotUI();}public void RemoveItem(ItemData _item)//将物体剔除Inventory的函数{if(inventoryDictianory.TryGetValue(_item,out InventoryItem value)){if (value.stackSize <= 1){inventoryItems.Remove(value);inventoryDictianory.Remove(_item);}elsevalue.RemoveStack();}UpdateSlotUI();}}
ItemObject.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class ItemObject : MonoBehaviour
{private SpriteRenderer sr;[SerializeField] private ItemData ItemData;private void OnValidate()//https://blog.csdn.net/paserity/article/details/130014259//大抵就是在Unity加载脚本或检查器中的值更改时调用。实时更新资产文件,比如材质、shader{GetComponent<SpriteRenderer>().sprite = ItemData.icon;gameObject.name = ItemData.name;}//private void Start()//{//    sr = GetComponent<SpriteRenderer>();//    sr.sprite = ItemData.icon;//}private void OnTriggerEnter2D(Collider2D collision){if(collision.GetComponent<Player>()!= null){Inventory.instance.AddItem(ItemData);Destroy(gameObject);}}}

http://www.hkea.cn/news/893851/

相关文章:

  • 成都解放号网站建设什么是百度竞价
  • 网站优化的基本思想与原则百度号码
  • 沧州网站建设制作设计优化深圳seo优化推广
  • 建立一个网站需要什么技术网上培训机构
  • 网站设计与管理论文百度账号注册平台
  • 网站空间商推荐seo是什么职位缩写
  • 怎么建设boss网站文件外链
  • 百度推广网站建设费百度搜索引擎的网址是多少
  • php 手机网站 上传图片定制网站建设
  • 关于网站建设的问题百度关键词分析
  • 登录官方网站装修公司网络推广方案
  • 设计网站官网入口网站搜索优化方法
  • 网站优化qq群山东做网站
  • wordpress icomoon太原seo快速排名
  • 中华建设杂志网站记者数据指数
  • 网站开发测试情况南召seo快速排名价格
  • 上海仓储公司小红书seo优化
  • 南京建设公司网站网络营销整合推广
  • wordpress更改语言沈阳seo优化
  • wordpress免费网站世界大学排名
  • 做网站的属于什么专业?百度爱采购竞价推广
  • 网站建设一年多少恰东莞网站到首页排名
  • 新企业网站应该怎么做SEO优化广告联盟有哪些
  • 手机app开发网站建设软文推广文章案例
  • 网站自然排名百度经验官网登录
  • dz网站模板沧州网站优化公司
  • 桂林论坛天涯社区培训行业seo整站优化
  • 做伊瑞尔竞技场的网站搜索引擎简称seo
  • 46云虚拟主机股票发行ipo和seo是什么意思
  • 新泰做网站菏泽seo