Quellcode durchsuchen

补充动画过渡

zhengchen vor 1 Jahr
Ursprung
Commit
4862a7f31c

+ 29 - 3
Assets/Resources/Human/Master Animator Controller.controller

@@ -37,6 +37,7 @@ AnimatorState:
   m_CycleOffset: 0
   m_Transitions:
   - {fileID: -2843321966730675431}
+  - {fileID: 355894681928993082}
   m_StateMachineBehaviours: []
   m_Position: {x: 50, y: 50, z: 0}
   m_IKOnFeet: 0
@@ -102,7 +103,7 @@ AnimatorState:
   m_TimeParameterActive: 0
   m_Motion: {fileID: 1827226128182048838, guid: a3e404fcbc655f3488725c8fe814fc5d,
     type: 3}
-  m_Tag: 
+  m_Tag: walk
   m_SpeedParameter: 
   m_MirrorParameter: 
   m_CycleOffsetParameter: 
@@ -250,13 +251,13 @@ AnimatorController:
     m_DefaultFloat: 0
     m_DefaultInt: 0
     m_DefaultBool: 0
-    m_Controller: {fileID: 0}
+    m_Controller: {fileID: 9100000}
   - m_Name: putdown
     m_Type: 9
     m_DefaultFloat: 0
     m_DefaultInt: 0
     m_DefaultBool: 0
-    m_Controller: {fileID: 0}
+    m_Controller: {fileID: 9100000}
   m_AnimatorLayers:
   - serializedVersion: 5
     m_Name: Base Layer
@@ -295,6 +296,31 @@ AnimatorStateTransition:
   m_InterruptionSource: 0
   m_OrderedInterruption: 1
   m_CanTransitionToSelf: 1
+--- !u!1101 &355894681928993082
+AnimatorStateTransition:
+  m_ObjectHideFlags: 1
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: 
+  m_Conditions:
+  - m_ConditionMode: 6
+    m_ConditionEvent: status
+    m_EventTreshold: 1
+  m_DstStateMachine: {fileID: 0}
+  m_DstState: {fileID: -3979362244818739171}
+  m_Solo: 0
+  m_Mute: 0
+  m_IsExit: 0
+  serializedVersion: 3
+  m_TransitionDuration: 0.25
+  m_TransitionOffset: 0
+  m_ExitTime: 0.85
+  m_HasExitTime: 0
+  m_HasFixedDuration: 1
+  m_InterruptionSource: 0
+  m_OrderedInterruption: 1
+  m_CanTransitionToSelf: 1
 --- !u!1107 &391782714800293588
 AnimatorStateMachine:
   serializedVersion: 6

+ 9 - 0
Assets/Scenes/Battle.unity

@@ -1991,6 +1991,7 @@ GameObject:
   - component: {fileID: 963194228}
   - component: {fileID: 963194227}
   - component: {fileID: 963194229}
+  - component: {fileID: 963194230}
   m_Layer: 0
   m_Name: Main Camera
   m_TagString: MainCamera
@@ -2089,6 +2090,14 @@ MonoBehaviour:
   m_RequiresDepthTexture: 0
   m_RequiresColorTexture: 0
   m_Version: 2
+--- !u!81 &963194230
+AudioListener:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 963194225}
+  m_Enabled: 1
 --- !u!1001 &998224487
 PrefabInstance:
   m_ObjectHideFlags: 0

+ 7 - 5
Assets/Scripts/Comp/BattleMainComp.cs

@@ -28,9 +28,9 @@ namespace Comp
             SoundCore.Instance.PlaySound(SoundType.BattleBgmMain, SoundCtrl.BattleBgmPlayer, true, true);
             MessageComp.Instance.OnBattleClientMsg += OnClientMsg;
             MessageComp.Instance.OnBattlePlayerQuit += OnPlayerQuit;
-// #if UNITY_EDITOR
-//             _debug = true;
-// #endif
+#if UNITY_EDITOR
+            _debug = true;
+#endif
             if (_debug)
             {
                 var logs =
@@ -41,6 +41,7 @@ namespace Comp
             else
             {
                 localName.text = AccountManager.Instance.selfInfo.name;
+                Debug.Log("curSession===" + GameCore.Instance.curBattleSession);
                 ApiComp.Instance.GetBattleDetail(GameCore.Instance.curBattleSession,
                     (obj) => { StartCoroutine(StartGame(obj)); }, (code, msg) =>
                     {
@@ -104,8 +105,9 @@ namespace Comp
         }
 
         public void Lift()
-        {
-            ApiComp.Instance.MsgInBattle(GameCore.Instance.curBattleSession, new MsgContent() { contentType = "lift" });
+        {   
+            Debug.Log("click lift");
+            // ApiComp.Instance.MsgInBattle(GameCore.Instance.curBattleSession, new MsgContent() { contentType = "lift" });
             GameCore.Instance.GetCurState().LiftCock();
         }
 

+ 0 - 2
Assets/Scripts/Comp/CockActionComp.cs

@@ -111,7 +111,6 @@ namespace Comp
             if (CloseGravity)
             {
                 _rigidbody.useGravity = false;
-                Debug.Log("关闭重力" + _rigidbody.useGravity + "===" + playerId);
                 if (stayPos != Vector3.zero)
                     transform.localPosition = stayPos;
             }
@@ -123,7 +122,6 @@ namespace Comp
                 OpenGravity = false;
                 _rigidbody.useGravity = true;
                 _rigidbody.velocity = Vector3.zero;
-                Debug.Log("开启重力" + _rigidbody.useGravity + "===" + playerId);
             }
         }
 

+ 9 - 2
Assets/Scripts/Comp/LiftButtonComp.cs

@@ -19,10 +19,17 @@ namespace Comp
             if (GameCore.Instance.localPlayer == null) return;
             var lastHpPercent = (float)GameCore.Instance.localPlayer.runTimeHp / GameCore.Instance.localPlayer.hp;
             if (GameCore.Instance.GetCurState() != null && GameCore.Instance.battleState != null &&
-                GameCore.Instance.GetCurState() == GameCore.Instance.battleState && GameCore.Instance.liftTimes > 0 &&
-                lastHpPercent <= 0.5f)
+                GameCore.Instance.GetCurState() == GameCore.Instance.battleState && GameCore.Instance.liftTimes > 0 )
             {
+#if UNITY_EDITOR
                 _button.interactable = true;
+#else
+                if(lastHpPercent <= 0.5f){
+                    _button.interactable = true;
+                } else {
+                    _button.interactable = false;
+                }
+#endif
             }
             else
             {

+ 14 - 4
Assets/Scripts/Comp/MasterActionComp.cs

@@ -41,6 +41,8 @@ namespace Comp
 
         public int playerId;
 
+        private bool _startCheckPos = false; // 过了碰撞点再开始检查是否复位
+
         private void Start()
         {
             _animator = GetComponent<Animator>();
@@ -54,13 +56,13 @@ namespace Comp
         private void OnWalk()
         {
             _thrust = new Vector3(0, 0, MoveSpeed);
+            Debug.Log("start walk");
             StartCoroutine(CockRayCast());
         }
 
         private IEnumerator CockRayCast() // 判断碰撞点,现在不用射线了
         {
             yield return new WaitForSeconds(1f);
-            Debug.Log("lift cock");
             var actionComp = GameCore.Instance.GetCockActionCompByPlayerId(playerId);
             var cockObj = actionComp.gameObject;
             _cock = cockObj;
@@ -80,16 +82,22 @@ namespace Comp
                 if ((transform.forward.x > 0 && transform.position.x <= _initialX) ||
                     (transform.forward.x < 0 && transform.position.x >= _initialX))
                 {
-                    _masterController.Idle();
-                    GameCore.Instance.ReportMasterBack(transform.forward.x > 0);
+                    if (_startCheckPos)
+                    {
+                        _thrust = Vector3.zero;
+                        _masterController.Idle();
+                        _startCheckPos = false;
+                        GameCore.Instance.ReportMasterBack(transform.forward.x > 0);
+                    }
                 }
                 else
                 {
                     transform.Translate(_rThrust * Time.deltaTime);
                 }
             }
-            else
+            else if (stateInfo.IsTag("walk"))
             {
+                Debug.Log("move speed is " + _thrust);
                 transform.Translate(_thrust * Time.deltaTime);
             }
 
@@ -103,6 +111,7 @@ namespace Comp
                 if (_collisionX != 0 && transform.position.x >= _collisionX)
                 {
                     _thrust = Vector3.zero;
+                    _startCheckPos = true;
                     _masterController.Lift();
                 }
             }
@@ -111,6 +120,7 @@ namespace Comp
                 if (_collisionX != 0 && transform.position.x <= _collisionX)
                 {
                     _thrust = Vector3.zero;
+                    _startCheckPos = true;
                     _masterController.Lift();
                 }
             }

+ 0 - 1
Assets/Scripts/Game/CockFactory.cs

@@ -20,7 +20,6 @@ namespace Game
         public GameObject GenerateCockPrefab(int cockId)
         {
             var cockExist = _cockPrefabDict.TryGetValue(cockId, out var path);
-            Debug.LogWarning("获取斗鸡模型 " + cockId + " 结果 " + cockExist);
             var prefab = Resources.Load<GameObject>(path);
             return prefab;
         }

+ 1 - 2
Assets/Scripts/Game/GameCore.cs

@@ -125,11 +125,10 @@ namespace Game
             {
                 masterBack.Item2 = true;
             }
-
+            Debug.Log("report master back " + masterBack.Item1 + " " + masterBack.Item2);
             if (masterBack.Item1 && masterBack.Item2)
             {
                 if (currentState != liftState) return;
-                masterBack = (false, false);
                 TransitionToState(battleState);
             }
         }

+ 2 - 2
Assets/Scripts/Game/GameLiftState.cs

@@ -45,8 +45,8 @@ namespace Game
         }
 
         public override void ExitState()
-        {
-           
+        { 
+            _gameCore.masterBack = (false, false);
         }
     }
 }