Esempio n. 1
0
    void Start()
    {
        startposition = transform.position;
        var angle = transform.eulerAngles.z;

        body          = GetComponent <Rigidbody2D>();
        body.velocity = Vector2Utils.CreateVector(Speed, angle * Mathf.Deg2Rad);
    }
Esempio n. 2
0
        private void OnCollisionEnter2D(Collision2D other)
        {
            if (!other.gameObject.CompareTag("Reflective"))
            {
                return;
            }

            Vector2 reflected = Vector3.Reflect(Vector2Utils.CreateVector(1, Angle * Mathf.Deg2Rad),
                                                other.GetContact(0).normal);

            Angle = reflected.GetAngle() * Mathf.Rad2Deg;
            OnHitShield();
        }
Esempio n. 3
0
 private void LateUpdate()
 {
     Body.velocity = Vector2Utils.CreateVector(Speed, Angle * Mathf.Deg2Rad);
 }