Esempio n. 1
0
        void Start()
        {
            colliderRadius = GetComponent <CircleCollider2D>().radius;
            rb             = GetComponent <Rigidbody2D>();
            movement       = GetComponent <Movement2D>();

            StartCoroutine(NextDirection());
        }
        public virtual void AddKnockback(Collider2D collision)
        {
            Movement2D movement = collision.GetComponent <Movement2D>();

            if (movement != null)
            {
                Vector2 force = velocity.normalized * knockbackForce;
                movement.AddKnockback(force, knockbackDuration);
            }
        }
Esempio n. 3
0
 void Start()
 {
     rb       = GetComponent <Rigidbody2D>();
     movement = GetComponent <Movement2D>();
 }