Selaa lähdekoodia

修复举J Bug

zhengchen 1 vuosi sitten
vanhempi
commit
04f46e6578

+ 1 - 1
Assets/Scripts/Comp/BattleMainComp.cs

@@ -105,7 +105,7 @@ namespace Comp
 
         public void Lift()
         {
-            ApiComp.Instance.MsgInBattle(GameCore.Instance.curBattleSession, new MsgContent() { contentType = "lift" });
+            // ApiComp.Instance.MsgInBattle(GameCore.Instance.curBattleSession, new MsgContent() { contentType = "lift" });
             GameCore.Instance.GetCurState().LiftCock();
         }
 

+ 15 - 36
Assets/Scripts/Comp/MasterActionComp.cs

@@ -17,7 +17,7 @@ namespace Comp
 
         private Vector3 _thrust;
 
-        private Vector3 _rThrust = new Vector3(0, 0, -MoveSpeed);
+        private readonly Vector3 _rThrust = new Vector3(0, 0, -MoveSpeed);
 
         private const float MoveSpeed = 1f;
 
@@ -37,7 +37,7 @@ namespace Comp
 
         private Vector3 _liftPos;
 
-        private bool _putdown = false;
+        private bool _isPutDown = false;
 
         public int playerId;
 
@@ -60,39 +60,16 @@ namespace Comp
         private IEnumerator CockRayCast()
         {
             yield return new WaitForSeconds(1f);
-            for (float i = _miniY - 2f; i <= 2f; i += 0.05f) // 多次碰撞寻找自己的cock
+            var cockObj = GameCore.Instance.GetCockActionCompByPlayerId(playerId).gameObject;
+            _cock = cockObj;
+            if (playerId == GameCore.Instance.localPlayer.playerId)
+                _collisionX = _cock.transform.position.x - 1f;
+            else
             {
-                var position = transform.position;
-                position.y = _miniY; // 创建射线基础位置,y为脚底
-                var ray = new Ray(position, transform.forward); // 创建前进射线
-                if (Physics.Raycast(ray, out var hitInfo))
-                {
-                    // 发生碰撞,处理碰撞事件
-                    Debug.Log("Hit object: " + hitInfo.collider.gameObject.name);
-                    _collisionX = hitInfo.point.x;
-                    if (hitInfo.collider.CompareTag("cock"))
-                    {
-                        var comp = hitInfo.collider.gameObject.GetComponent<CockActionComp>();
-                        if (comp.playerId != playerId)
-                        {
-                            Debug.Log("不是自己的cock");
-                        }
-                        else
-                        {
-                            _cock = hitInfo.collider.gameObject;
-                            break;
-                        }
-                    }
-                    else
-                    {
-                        Debug.Log("碰撞单位不是cock");
-                    }
-                }
-                else
-                {
-                    Debug.LogWarning("无碰撞");
-                }
+                _collisionX = _cock.transform.position.x + 1f;
             }
+
+            _cock.GetComponent<Rigidbody>().useGravity = false; // 取消重力
         }
 
         private void FixedUpdate()
@@ -141,7 +118,7 @@ namespace Comp
 
         private void OnLowest() // 抱起动画最低点回调
         {
-            if (!_putdown)
+            if (!_isPutDown)
             {
                 _liftPos = _cock.transform.position;
                 _cock.transform.parent = transform;
@@ -158,20 +135,22 @@ namespace Comp
                         _cock.transform.localPosition = new Vector3(0, 0.9f, 0.3f);
                         break;
                 }
+
                 StartCoroutine(PutDown());
             }
             else
             {
                 _cock.transform.parent = GameCore.Instance.parent.transform;
                 _cock.transform.position = _liftPos;
-                _putdown = false;
+                _cock.GetComponent<Rigidbody>().useGravity = true;
+                _isPutDown = false;
             }
         }
 
         private IEnumerator PutDown()
         {
             yield return new WaitForSeconds(5f); // 5秒后放下来
-            _putdown = true;
+            _isPutDown = true;
             _masterController.PutDown();
         }
     }

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

@@ -37,10 +37,6 @@ namespace Game
         {
             _gameCore.masterBack.Item1 = false;
             _gameCore.masterBack.Item2 = false;
-            foreach (var cockActionComp in _gameCore.cockActionComps)
-            {
-                cockActionComp.Value.gameObject.GetComponent<SphereCollider>().isTrigger = true;
-            }
             foreach (var masterActionComp in _gameCore.masterDict)
             {
                 masterActionComp.Value.MasterController.Walk();
@@ -49,10 +45,7 @@ namespace Game
 
         public override void ExitState()
         {
-            foreach (var cockActionComp in _gameCore.cockActionComps)
-            {
-                cockActionComp.Value.gameObject.GetComponent<SphereCollider>().isTrigger = false;
-            }
+           
         }
     }
 }

+ 11 - 5
ProjectSettings/ProjectSettings.asset

@@ -13,7 +13,7 @@ PlayerSettings:
   useOnDemandResources: 0
   accelerometerFrequency: 60
   companyName: DefaultCompany
-  productName: Cock
+  productName: Come On Roosters
   defaultCursor: {fileID: 0}
   cursorHotspot: {x: 0, y: 0}
   m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
@@ -145,7 +145,7 @@ PlayerSettings:
     16:10: 1
     16:9: 1
     Others: 1
-  bundleVersion: 1.0.2
+  bundleVersion: 1.0.3
   preloadedAssets:
   - {fileID: 3631518619006024534, guid: 67fdd7a6b94fc46bc8ae68e0872669b0, type: 2}
   - {fileID: 11400000, guid: c09f357707e48432f97126356e4061fd, type: 2}
@@ -283,7 +283,14 @@ PlayerSettings:
   AndroidMinifyDebug: 0
   AndroidValidateAppBundleSize: 1
   AndroidAppBundleSizeToValidate: 150
-  m_BuildTargetIcons: []
+  m_BuildTargetIcons:
+  - m_BuildTarget: 
+    m_Icons:
+    - serializedVersion: 2
+      m_Icon: {fileID: 2800000, guid: 1dace0f9dae934069929e4a0fd153df3, type: 3}
+      m_Width: 128
+      m_Height: 128
+      m_Kind: 0
   m_BuildTargetPlatformIcons:
   - m_BuildTarget: iPhone
     m_Icons:
@@ -712,7 +719,6 @@ PlayerSettings:
   switchNetworkInterfaceManagerInitializeEnabled: 1
   switchPlayerConnectionEnabled: 1
   switchUseNewStyleFilepaths: 0
-  switchUseLegacyFmodPriorities: 1
   switchUseMicroSleepForYield: 1
   switchEnableRamDiskSupport: 0
   switchMicroSleepForYieldTime: 25
@@ -826,7 +832,7 @@ PlayerSettings:
   allowUnsafeCode: 0
   useDeterministicCompilation: 1
   enableRoslynAnalyzers: 1
-  selectedPlatform: 0
+  selectedPlatform: 2
   additionalIl2CppArgs: 
   scriptingRuntimeVersion: 1
   gcIncremental: 1