2
0

4 Revīzijas 7aaa114ebe ... a24f7fb463

Autors SHA1 Ziņojums Datums
  zhengchen a24f7fb463 Merge remote-tracking branch 'origin/master' 1 gadu atpakaļ
  zhengchen e5499ae04d 修复跳跃的时候取消重力的问题 1 gadu atpakaļ
  zhengchen b2570e651b 修复举J问题 1 gadu atpakaļ
  zhengchen 04f46e6578 修复举J Bug 1 gadu atpakaļ

+ 0 - 9
Assets/Scenes/Battle.unity

@@ -1991,7 +1991,6 @@ GameObject:
   - component: {fileID: 963194228}
   - component: {fileID: 963194227}
   - component: {fileID: 963194229}
-  - component: {fileID: 963194230}
   m_Layer: 0
   m_Name: Main Camera
   m_TagString: MainCamera
@@ -2090,14 +2089,6 @@ 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

+ 13 - 27
Assets/Scripts/Comp/CockActionComp.cs

@@ -29,6 +29,8 @@ namespace Comp
 
         private readonly WaitForSeconds _waitEverySecond = new WaitForSeconds(1f);
 
+        private Rigidbody _rigidbody;
+
         // 水平与垂直方向运动相关
 
         public int playerId;
@@ -43,6 +45,8 @@ namespace Comp
 
         private bool _createMiss = false;
 
+        public bool willBeLift = false;
+
         public ICockController CockController
         {
             get
@@ -70,6 +74,7 @@ namespace Comp
         private void Awake()
         {
             _cockMoveComp = GetComponent<CockMoveComp>();
+            _rigidbody = GetComponent<Rigidbody>();
         }
 
         private void Start()
@@ -95,33 +100,6 @@ namespace Comp
             CreateMissText();
         }
 
-        private void FixedUpdate()
-        {
-            // transform.Translate(_thrust * Time.deltaTime);
-
-            // 移动游戏对象
-            // if (GameCore.Instance.inBattleState)
-            // transform.position += _curData.GetJumpVector();
-            // if (GameCore.Instance.inBattleState)
-            // {
-            //     if (rightForward)
-            //     {
-            //         transform.position += _curData.GetMoveVector();
-            //     }
-            //     else
-            //     {
-            //         transform.position -= _curData.GetMoveVector();
-            //     }
-            // }
-
-            // if (transform.position.y < _miniY)
-            // {
-            //     var position = transform.position;
-            //     position = new Vector3(position.x, _miniY, position.z);
-            //     transform.position = position;
-            // }
-        }
-
         private void OnRun()
         {
             _cockMoveComp.MoveAndNeverStop();
@@ -147,10 +125,18 @@ namespace Comp
 
         public void OnAttackEnd()
         {
+            if (willBeLift)
+            {
+                _rigidbody.useGravity = false;
+            }
         }
 
         public void OnJumpEnd()
         {
+            if (willBeLift)
+            {
+                _rigidbody.useGravity = false;
+            }
         }
 
         public void SetHighJump(bool high)

+ 17 - 37
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;
 
@@ -57,42 +57,20 @@ namespace Comp
             StartCoroutine(CockRayCast());
         }
 
-        private IEnumerator CockRayCast()
+        private IEnumerator CockRayCast() // 判断碰撞点,现在不用射线了
         {
             yield return new WaitForSeconds(1f);
-            for (float i = _miniY - 2f; i <= 2f; i += 0.05f) // 多次碰撞寻找自己的cock
+            var actionComp = GameCore.Instance.GetCockActionCompByPlayerId(playerId);
+            var cockObj = actionComp.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;
             }
+
+            actionComp.willBeLift = true;
         }
 
         private void FixedUpdate()
@@ -141,7 +119,7 @@ namespace Comp
 
         private void OnLowest() // 抱起动画最低点回调
         {
-            if (!_putdown)
+            if (!_isPutDown)
             {
                 _liftPos = _cock.transform.position;
                 _cock.transform.parent = transform;
@@ -158,20 +136,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