git地址:https://gitee.com/asiworld/MakeAModelFrom-code
csdn博客地址:https://blog.csdn.net/JianShengShuaiest
bilibili地址:https://space.bilibili.com/15766978
效果预览
Layers修改
制作敌人的坦克
制作炮弹
-
拖出一个炮弹
-
设置坐标<0,1.5,2>
-
设置layer
-
添加rigidbody
-
添加meshcollider
-
修改meshcollider convex = true
-
is trigger = true
-
添加playmaker
制作我方坦克的开炮模块
-
拖出有移动模块的我方坦克
-
设置坐标<0,0,0>
-
添加一个炮弹在炮弹口,起名炮弹位置
-
设置layer-我方坦克
-
设置坦克的rigidbody
-
添加CapsuleCollider
-
添加装弹UI
-
添加playmaker
-
添加动作+变量
using UnityEngine; using UnityEngine.UI; using DG.Tweening; namespace HutongGames.PlayMaker.Actions { [ActionCategory("Dotween")] public class DoSlider : FsmStateAction { public Slider slider; public FsmFloat m_fBeginValue; public FsmFloat m_fEndValue; public FsmFloat m_fTime; // Code that runs on entering the state. public override void OnEnter() { slider.value = m_fBeginValue.Value; slider.DOValue(m_fEndValue.Value, m_fTime.Value); Finish(); } } }