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

找工作哪个网站好58同城做网站最简单的

找工作哪个网站好58同城,做网站最简单的,做电影网站服务器,成都网站推广多少钱1、目标 当橡树被砍伐时的落叶粒子效果。 2、创建粒子物体 Hierarchy -> PersistentScene下创建新物体命名为DeciduousLeavesFalling。 添加Particle System组件。 基础配置如下:(暂时勾选Looping实时可以看生成效果,后面反选即可&am…

1、目标

当橡树被砍伐时的落叶粒子效果。

2、创建粒子物体

Hierarchy -> PersistentScene下创建新物体命名为DeciduousLeavesFalling。

添加Particle System组件。

基础配置如下:(暂时勾选Looping实时可以看生成效果,后面反选即可)

配置Emission和Shape信息如下:

配置Color over Lifetime:

配置Size over Lifetime / Rotation over Lifetime / Noise 信息如下:

配置Texture / Renderer 信息如下:

将DeciduousLeavesFalling移到Assets -> Prefabs -> Crop -> Effect下

3、修改Crop.cs脚本

[Tooltip("This should be populated from child transform gameobject showing harvest effect spawn point")]
[SerializeField] private Transform harvestActionEffectTransform = null;

在ProcessToolAction函数中添加:

完整代码为:

public void ProcessToolAction(ItemDetails equippedItemDetails, bool isToolRight, bool isToolLeft, bool isToolDown, bool isToolUp)
{// Get grid property detailsGridPropertyDetails gridPropertyDetails = GridPropertiesManager.Instance.GetGridPropertyDetails(cropGridPosition.x, cropGridPosition.y);if (gridPropertyDetails == null)return;// Get seed item detailsItemDetails seedItemDetails = InventoryManager.Instance.GetItemDetails(gridPropertyDetails.seedItemCode);if(seedItemDetails == null) return;// Get crop detailsCropDetails cropDetails = GridPropertiesManager.Instance.GetCropDetails(seedItemDetails.itemCode);if (cropDetails == null) return;// Get animator for crop if presentAnimator animator = GetComponentInChildren<Animator>();// Trigger tool animationif(animator != null){if(isToolRight || isToolUp){animator.SetTrigger("usetoolright");}else if(isToolLeft || isToolDown){animator.SetTrigger("usetoolleft");}}// Trigger tool particle effect on cropif (cropDetails.isHarvestActionEffect){EventHandler.CallHarvestActionEffectEvent(harvestActionEffectTransform.position, cropDetails.harvestActionEffect);}// Get required harvest actions for tool(收获此农作物所需的操作次数)int requiredHarvestActions = cropDetails.RequiredHarvestActionsForTool(equippedItemDetails.itemCode);if (requiredHarvestActions == -1) return;// Increment harvest action countharvestActionCount++;// Check if required harvest actions madeif (harvestActionCount >= requiredHarvestActions)HarvestCrop(isToolRight, isToolUp, cropDetails, gridPropertyDetails, animator);}

4、修改CropTreeCanyonOak预设体

在CropSprite下新增一个物体命名为LeavesSpawnPoint,这个作为特效的参考点,修改其Position(Y)为4。

接着点击CropTreeCanyonOak进行变量赋值。

5、修改PoolManager对象

6、修改VFXManager.cs脚本及配置

添加定义:

 [SerializeField] private GameObject deciduousLeavesFallingPrefab = null;

在displayHarvestActionEffect中添加case信息如下:

case HarvestActionEffect.deciduousLeavesFalling:GameObject deciduousLeavesFalling = PoolManager.Instance.ReuseObject(deciduousLeavesFallingPrefab, effectPosition, Quaternion.identity);deciduousLeavesFalling.SetActive(true);StartCoroutine(DisableHarvestActionEffect(deciduousLeavesFalling, twoSeconds));break;

完整的代码如下:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class VFXManager : SingletonMonobehaviour<VFXManager>
{private WaitForSeconds twoSeconds;[SerializeField] private GameObject reapingPrefab = null;[SerializeField] private GameObject deciduousLeavesFallingPrefab = null;protected override void Awake(){base.Awake();twoSeconds = new WaitForSeconds(2f);}private void OnDisable(){EventHandler.HarvestActionEffectEvent -= displayHarvestActionEffect;}private void OnEnable(){EventHandler.HarvestActionEffectEvent += displayHarvestActionEffect;}private IEnumerator DisableHarvestActionEffect(GameObject effectGameObject, WaitForSeconds secondsToWait){yield return secondsToWait;effectGameObject.SetActive(false);}private void displayHarvestActionEffect(Vector3 effectPosition, HarvestActionEffect harvestActionEffect){switch(harvestActionEffect){case HarvestActionEffect.deciduousLeavesFalling:GameObject deciduousLeavesFalling = PoolManager.Instance.ReuseObject(deciduousLeavesFallingPrefab, effectPosition, Quaternion.identity);deciduousLeavesFalling.SetActive(true);StartCoroutine(DisableHarvestActionEffect(deciduousLeavesFalling, twoSeconds));break;case HarvestActionEffect.reaping:GameObject reaping = PoolManager.Instance.ReuseObject(reapingPrefab, effectPosition, Quaternion.identity);reaping.SetActive(true); StartCoroutine(DisableHarvestActionEffect(reaping, twoSeconds));break;case HarvestActionEffect.none:break;default:break;}}
}

配置VFXManager的信息如下:

7、运行游戏

http://www.dtcms.com/a/499047.html

相关文章:

  • 携程网站用js怎么做淄博哪家网络公司做网站好
  • Linux Shell 正则表达式中的 POSIX 字符集:用法与实战
  • MQTT协议,EMQX自建服务器
  • 力扣1287. 有序数组中出现次数超过25%的元素
  • Linux网络与路由配置完全指南
  • 【高并发服务器】六、日志宏的实现
  • 什么是网络割接
  • 中山网站建设文化报价个人网站设计结构图
  • 专业简历制作网站推荐渭南网站建设网站排名优化
  • Electron学习(一):创建第一个应用并打包成功
  • EF Core FromExpression 方法
  • 工厂方法模式
  • 做装机u盘那个网站好市桥做网站
  • SAP MM采购对账功能分享
  • 网页设计与网站建设考试名词解释2019网站建设工作的作用
  • 【有源码】基于Python与Spark的火锅店数据可视化分析系统-基于机器学习的火锅店综合竞争力评估与可视化分析-基于用户画像聚类的火锅店市场细分与可视化研究
  • Linux: perf: sched latency,周期性抓取看趋势,做对比
  • 统计学重要思想
  • Android 本地存储方案深度解析:SharedPreferences、DataStore、MMKV 全面对比
  • 网站开发前后端中山做外贸网站
  • ElastiCache Redis 内存告警深度分析与运维实战指南
  • Spring5.3.10源码编译和调试(IDEA+Gradle)的过程
  • JS | 知识点总结 - 原型链
  • 【Docker】Docker镜像仓库
  • EEException: Geometry.area: Unable to perform this geometry operation.
  • 逻辑和共情
  • linux安装输入法
  • git连接远程仓库并拉去推送以及克隆命令
  • steam新品节游戏推荐!手机怎么玩steam游戏!
  • OpenHarmony Stage模型深度解剖:从Ability Kit到沙箱隔离的全链路底层原理