diff options
author | chai <chaifix@163.com> | 2022-04-18 15:48:28 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-04-18 15:48:28 +0800 |
commit | dc5edaf1025ff4cebaa41eba9a36f854b80d91ec (patch) | |
tree | 6d7a0c789506397f0262c5b3f1eb86ffddde97f8 /AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs | |
parent | b1882e100887ff1ce6cd6902109a25aea4a20fa5 (diff) |
*misc
Diffstat (limited to 'AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs')
-rw-r--r-- | AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs b/AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs index dafd7e0..665c406 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs @@ -63,34 +63,6 @@ public class TestWaspRobot : MonoBehaviour void Update() { - //float distance = (m_Follow.positionOnGround - m_Coords.positionOnGround).magnitude; - //m_Following = distance > m_Radius + 0.1f; - - //if (m_Following) - //{ - // Vector2 dir = (m_Follow.positionOnGround - m_Coords.positionOnGround).normalized; - - // Vector2 posOnGround = m_Coords.positionOnGround; - // posOnGround.x += m_MoveSpeed * Time.deltaTime * dir.x; - // posOnGround.y += m_MoveSpeed * Time.deltaTime * dir.y; - - // m_Coords.positionOnGround = posOnGround; - - // //m_SpriteRenderer.flipX = m_Follow.x < m_Coords.x; - //} - //else - //{ - // m_Angle += Time.deltaTime * m_OrbitSpeed; - - // Vector2 centre = m_Follow.positionOnGround; - // centre += new Vector2(Mathf.Cos(m_Angle), Mathf.Sin(m_Angle)).normalized * m_Radius; - // m_Coords.positionOnGround = centre; - - // int index = ((int)Mathf.Floor(((m_Angle * Mathf.Rad2Deg) % 360) / 30)) % 12; - // m_SpriteRenderer.sprite = m_Sprites[index]; - // m_Shadow.sprite = m_Sprites[index]; - //} - float distance = (m_Follow.positionOnGround - m_Coords.positionOnGround).magnitude; m_Following = distance > m_Radius + 0.1f; @@ -121,6 +93,9 @@ public class TestWaspRobot : MonoBehaviour m_Coords.positionOnGround = posOnGround; float rad = GetAngleToTarget(); + + Debug.Log(rad * Mathf.Rad2Deg); + int index = GetSpriteIndex(rad); SetSprite(index); } @@ -155,7 +130,7 @@ public class TestWaspRobot : MonoBehaviour Vector2 dir = (posOnGround - target).normalized; - return Mathf.Atan2(dir.y, dir.x); + return Mathf.Atan2(dir.y, dir.x) + 2 * Mathf.PI * TestMathHelper.Check(dir.y < 0); } // angle rad |