瀏覽代碼

整理playercontroller

SZAND\msx_2 1 年之前
父節點
當前提交
b11f21a22c

+ 77 - 100
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -33,36 +33,78 @@ public enum PlayerAttackState
 
 public class PlayerController : MoveCharacter
 {
-    //public static PlayerController instance;
+    [Header("玩家属性")]
+    public int playerId;
+    public bool canJump;
+    public bool canfly;
+    public bool isTransfiguration = false; //已变身
+    public bool canTranSummon = true;
+    public bool endTranSummon;  //是否在结束变身后召唤英灵
+
+    [Header("变身英灵")]
+    public bool isUltimate;     //英灵释放大招
+    public bool keyTransfigurateRelease;    //松开英灵释放大招键
     public List<GameObject> changePrefabs;
-    private GameObject spiritObj;   //当前变身的对象
-    public int endChange = 0;
-    //public float changeTime;        //变身时长
-    //private float pastChangeTime;
+    public int[] needCorpses;
+    private GameObject spiritObj;           //当前变身的对象
+    public int endChange = 0;               //结束变身后召唤的英灵
 
-    public List<GameObject> demonicPrefabs;
-    public List<Vector3> demonicSummonPos;
-    public Dictionary<int, List<Demonic>> demonicDic;
-    public List<int> demonicId;
+    [Header("玩家组件")]
     public UIHP uiMp;
     public PlayerRope playerRope;
     public EventTrigger eventTrigger;
     public SprintLinkTrigger sprintLinkTrigger;
+    private Spirits spirits;
+    public Collider soulCollector;
+    public SkeletonMecanim skeletonMecanim;
+    public SkeletonDataAsset[] playerSpine;
+    private Collider playerSoulCollector;
 
-    public float jumpSpeed = 10;
-    public float airJumpSpeed = 10;
-    public float canAirJumpSpeed = 5;//y轴速度大于这个值时不能进行空中跳跃
-    //public float moveAcc = 5f;
-    //public float airMoveAcc = 3f;
-    public float rushSpeed = 100;
-    public float flySpeed = 5;
+    [Header("血量")]
+    private int curHp;
+    private int curTotalHp;
+
+    [Header("蓝耗")]
     public float mp;
     public float totalMp;
+    public bool isMpRepel = true;
+    public bool isRapedReply;
     public float mpReplySpeed = 1;
+    public float rapidReplySpeed;
+    public float lostMp;
+    private float addMp = 10;
+    public GameObject soul;
+    public GameObject rapidReplyEffect;
+
+    [Header("移动属性")]
+    public Vector2 moveVec;         //玩家不动时移动数据
+    [HideInInspector]
+    public Vector2 leftDir;
+
+    [Header("冲刺属性")]
+    public float rushSpeed = 100;
     public float rushCostMp = 5;
+    public Vector3 rushDir;
+    public float rushInvincibleTime = 0.2f;
+    [HideInInspector]
+    public float rushTime;
+    public float totalRushTime = 0.5f;
+    [HideInInspector]
+    public float cacheRushTime; //无法Rush时按下Rush键不会Rush,手感不好,缓存几帧,在这几帧内落地会立即Rush;
+    public float totalCacheRushTime = 0.1f;
+
+    [Header("链条属性")]
     public float sprintCostMp = 5;
+    [HideInInspector]
+    public float cachePullRopeTime;
+    public float totalCachePullRopeTime = 0.1f;
 
-    public float rushInvincibleTime = 0.2f;
+    [Header("跳跃属性")]
+    public float jumpSpeed = 10;
+    public float airJumpSpeed = 10;
+    public int airJumped;
+    public int airJumpNumber = 1;  //最大跳跃次数
+    public float canAirJumpSpeed = 5;//y轴速度大于这个值时不能进行空中跳跃
     [HideInInspector]
     public float canJumpTime; //离开平台后仍然可以跳跃的时间,用于提升手感
     public float leaveGroundCanJumpTime = 0.1f;
@@ -72,51 +114,40 @@ public class PlayerController : MoveCharacter
     [HideInInspector]
     public float tandemJumpTime; //即将落地时按下跳跃键不会跳跃,手感不好,缓存几帧,在这几帧内落地会立即跳跃;
     public float totalTandemJumpTime = 0.1f;
+
+    [Header("飞行属性")]
+    public float flySpeed = 5;
+    public float maxFlyHeight;
+
+    [Header("召唤属性")]
     [HideInInspector]
     public float summonTime;
     [HideInInspector]
-    public float cacheAttackTime; //无法攻击时按下攻击键不会攻击,手感不好,缓存几帧,在这几帧内落地会立即攻击;
-    public float totalCacheAttackTime = 0.1f;
-    [HideInInspector]
-    public float cachePullRopeTime;
-    public float totalCachePullRopeTime = 0.1f;
-    [HideInInspector]
     public float cacheSummonTime; //无法召唤时按下召唤键不会召唤,手感不好,缓存几帧,在这几帧内落地会立即召唤;
     public float totalCacheSummonTime = 0.1f;
     [HideInInspector]
     public int cacheSummonId;
-    [HideInInspector]
-    public float rushTime;
-    public float totalRushTime = 0.5f;
-    [HideInInspector]
-    public float cacheRushTime; //无法Rush时按下Rush键不会Rush,手感不好,缓存几帧,在这几帧内落地会立即Rush;
-    public float totalCacheRushTime = 0.1f;
 
-    public int airJumped;
-    public int airJumpNumber = 1;  //最大跳跃次数
+    [Header("召唤使魔")]
+    public List<GameObject> demonicPrefabs;
+    public List<Vector3> demonicSummonPos;
+    public Dictionary<int, List<Demonic>> demonicDic;
+    public List<int> demonicId;
+
+    [Header("攻击")]
     public PlayerAttackState attackState;
     public float attackMoveSpeed = 5f;
-    public Vector3 rushDir;
-
-    private int currentSpirit;  //当前将要召唤的英灵种类
-    private Spirits spirits;
-
-    public float lostMp;
-
-    public GameObject soul;
-    private float addMp = 10;
-    public Collider soulCollector;
-
-    public bool isTransfiguration = false; //已变身
-
-    public Vector2 moveVec;         //玩家不动时移动数据
+    [HideInInspector]
+    public float cacheAttackTime; //无法攻击时按下攻击键不会攻击,手感不好,缓存几帧,在这几帧内落地会立即攻击;
+    public float totalCacheAttackTime = 0.1f;
 
+    [Header("复活")]
     public float reviveTime;        //复活时间
     public float totalReviveTime;
 
+    [Header("玩家是否在基地")]
     public bool isBaseBtnOut = false;
 
-
     public bool btnJumpPress
     {
         get
@@ -247,38 +278,6 @@ public class PlayerController : MoveCharacter
     }
     [HideInInspector]
     public bool isKeepBtnNorth;
-    [HideInInspector]
-    public Vector2 leftDir;
-    public int playerId;
-    public SkeletonMecanim skeletonMecanim;
-    public SkeletonDataAsset[] playerSpine;
-    public bool canJump;
-    public bool canfly;
-    //public Vector2 leftDir
-    //{
-    //    get
-    //    {
-    //        int x = 0;
-    //        int y = 0;
-    //        if (Input.GetKey(KeyCode.A))
-    //        {
-    //            x--;
-    //        }
-    //        if (Input.GetKey(KeyCode.D))
-    //        {
-    //            x++;
-    //        }
-    //        if (Input.GetKey(KeyCode.S))
-    //        {
-    //            y--;
-    //        }
-    //        if (Input.GetKey(KeyCode.W))
-    //        {
-    //            y++;
-    //        }
-    //        return new Vector2(x, y);
-    //    }
-    //}
 
     public override void Init()
     {
@@ -485,8 +484,6 @@ public class PlayerController : MoveCharacter
         }
     }
 
-    public int[] needCorpses;
-
     void OnChooseSpirit()   //选英灵
     {
         if (!isTransfiguration)
@@ -505,9 +502,6 @@ public class PlayerController : MoveCharacter
         }
     }
 
-    public bool isUltimate;     //英灵释放大招
-    public bool keyTransfigurateRelease;    //松开英灵释放大招键
-
     void OnTransfigurate()      //变身
     {
         if (!isFloat && canMove && !isBaseBtnOut)
@@ -546,8 +540,6 @@ public class PlayerController : MoveCharacter
         //animalAni.SetInteger("state", (int)PlayerState.Rise);
     }
 
-    public bool canTranSummon = true;
-
     public bool CheckSummon()
     {
         if (cacheSummonTime > 0)
@@ -1450,12 +1442,6 @@ public class PlayerController : MoveCharacter
         Init();
     }
 
-    public bool isMpRepel = true;
-
-    public float rapidReplySpeed;
-    public bool isRapedReply;
-    public GameObject rapidReplyEffect;
-
     public void RapidReplyMp()
     {
         isRapedReply = true;
@@ -1670,8 +1656,6 @@ public class PlayerController : MoveCharacter
         }
     }
 
-    public float maxFlyHeight;
-
     public Vector3 AirMove(Vector3 velocity)
     {
         CheckTurn();
@@ -1702,13 +1686,10 @@ public class PlayerController : MoveCharacter
         return velocity;
     }
 
-    private Collider playerSoulCollector;
-
     public void Transfiguration(int id) //变身
     {
         playerSoulCollector = soulCollector;
         id = id - 3;
-        currentSpirit = id;
         if (id >= changePrefabs.Count)
         {
             Debug.LogError("未配置" + id + "号变身");
@@ -1794,10 +1775,6 @@ public class PlayerController : MoveCharacter
         ChangeState(CharacterState.Idle);
     }
 
-    private int curHp;
-    private int curTotalHp;
-    public bool endTranSummon;  //是否在结束变身后召唤英灵
-
     public void EndTransfiguration(int id)
     {
         isBaseBtnOut = false;

+ 0 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Base_Spirits/SpiritSystem.cs

@@ -172,7 +172,6 @@ public class SpiritSystem : MonoBehaviour
                 {
                     s1.currentSpirit = s1.TranSpirit(spirit);
                     tranHp1 = s1.hps[0];
-                    print(tranHp1);
                 }
                 break;
             case 1: