summaryrefslogtreecommitdiff
path: root/AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs')
-rw-r--r--AlienSurvival/Assets/Test/Scripts/TestWaspRobot.cs33
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