Exemple #1
0
    public virtual void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log(collision.gameObject.name + enterMessage);
        IFieldAffected fieldAffected = collision.GetComponent <IFieldAffected>();

        if (fieldAffected != null)
        {
            fieldAffected.OnFieldEnter(this);
        }
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
    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);
        }
    }