Przeglądaj źródła

修改举鸡碰撞盒

zhengchen 1 rok temu
rodzic
commit
0fbd81eaa0

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

@@ -36,6 +36,8 @@ namespace Comp
 
         public int playerId;
 
+        public int cockId;
+
         public bool rightForward = false;
 
         // miss文本相关参数

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

@@ -60,7 +60,7 @@ namespace Comp
         private IEnumerator CockRayCast()
         {
             yield return new WaitForSeconds(1f);
-            for (float i = _miniY-2f; i <= 2f; i += 0.05f) // 多次碰撞寻找自己的cock
+            for (float i = _miniY - 2f; i <= 2f; i += 0.05f) // 多次碰撞寻找自己的cock
             {
                 var position = transform.position;
                 position.y = _miniY; // 创建射线基础位置,y为脚底
@@ -145,7 +145,19 @@ namespace Comp
             {
                 _liftPos = _cock.transform.position;
                 _cock.transform.parent = transform;
-                _cock.transform.localPosition = new Vector3(0, 0.9f, 0.4f);
+                var comp = _cock.GetComponent<CockActionComp>();
+                switch (comp.cockId)
+                {
+                    case 1:
+                        _cock.transform.localPosition = new Vector3(0, 0.9f, 0.3f);
+                        break;
+                    case 2:
+                        _cock.transform.localPosition = new Vector3(0, 0.9f, 0.4f);
+                        break;
+                    default:
+                        _cock.transform.localPosition = new Vector3(0, 0.9f, 0.3f);
+                        break;
+                }
                 StartCoroutine(PutDown());
             }
             else

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

@@ -76,6 +76,8 @@ namespace Game
             this.battleMainComp = parent.GetComponent<BattleMainComp>();
             this.camera = camera;
             this.resultPanel = resultPanel;
+
+            localPlayer.cockId = 2;
             
             cockDict = new Dictionary<int, CockActionComp>();
             masterDict = new Dictionary<int, MasterActionComp>();

+ 10 - 1
Assets/Scripts/Game/GameLiftState.cs

@@ -1,3 +1,5 @@
+using UnityEngine;
+
 namespace Game
 {
     public class GameLiftState : GameState
@@ -35,6 +37,10 @@ namespace Game
         {
             _gameCore.masterBack.Item1 = false;
             _gameCore.masterBack.Item2 = false;
+            foreach (var cockActionComp in _gameCore.cockDict)
+            {
+                cockActionComp.Value.gameObject.GetComponent<SphereCollider>().isTrigger = true;
+            }
             foreach (var masterActionComp in _gameCore.masterDict)
             {
                 masterActionComp.Value.MasterController.Walk();
@@ -43,7 +49,10 @@ namespace Game
 
         public override void ExitState()
         {
-            
+            foreach (var cockActionComp in _gameCore.cockDict)
+            {
+                cockActionComp.Value.gameObject.GetComponent<SphereCollider>().isTrigger = false;
+            }
         }
     }
 }

+ 2 - 0
Assets/Scripts/Game/GamePendingState.cs

@@ -49,7 +49,9 @@ namespace Game
             var localCock = Object.Instantiate(localCockPrefab);
             var antiCock = Object.Instantiate(antiCockPrefab);
             var localCockActionComp = localCock.GetComponent<CockActionComp>();
+            localCockActionComp.cockId = _gameCore.localPlayer.cockId;
             var antiCockActionComp = antiCock.GetComponent<CockActionComp>();
+            antiCockActionComp.cockId = _gameCore.antiPlayer.cockId;
             localCockActionComp.playerId = _gameCore.localPlayer.playerId;
             antiCockActionComp.playerId = _gameCore.antiPlayer.playerId;
             _gameCore.cockDict.Add(_gameCore.localPlayer.playerId, localCockActionComp);

+ 1 - 1
Assets/Scripts/UI/Hall/HallComp.cs

@@ -73,7 +73,7 @@ namespace UI
         private void TTT()
         {
             DefaultSelectOnlinePlayerTypeButton.onClick.Invoke();
-            // GameStartJumper.JumpGameScene("100020VS100019:1680153980543:WNBIDVLNYT");
+            GameStartJumper.JumpGameScene("100020VS100019:1680153980543:WNBIDVLNYT");
         }
 
         public void A__ClickUpdateInfo()