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); } }
void Start() { rb = GetComponent <Rigidbody2D>(); movement = GetComponent <Movement2D>(); }