public virtual void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.gameObject.name + enterMessage); IFieldAffected fieldAffected = collision.GetComponent <IFieldAffected>(); if (fieldAffected != null) { fieldAffected.OnFieldEnter(this); } }
public override void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.gameObject.name + enterMessage); IFieldAffected fieldAffected = collision.GetComponent <IFieldAffected>(); IDamageable damageable = collision.GetComponent <IDamageable>(); if (fieldAffected != null && damageable != null) { fieldAffected.OnFieldEnter(this); } }
public override void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.gameObject.name + enterMessage); IFieldAffected fieldAffected = collision.GetComponent <IFieldAffected>(); MovementModel movementModel = collision.GetComponent <MovementModel>(); if (fieldAffected != null && movementModel != null) { fieldAffected.OnFieldEnter(this); movementModel.SetGravity(gravityValue); } }