public override bool DoInteracted(CharacterActor characterActor, Direction direction, GameObject interactor) { CharacterActor otherCharacterActor = interactor.GetComponent <CharacterActor>(); if (otherCharacterActor) { Collider2D collision = otherCharacterActor.thisInteractionCollider2D; // Demote enemies to a smaller state or kill them if they are // below or the same y distance as Goomba if (characterActor.IsBrainEnemy(otherCharacterActor.brain)) { if (Utilities.CheckOtherColliderDirection2D(Direction.Down, characterActor.thisInteractionCollider2D, collision)) { if (otherCharacterActor.formStateMachine.currentState != otherCharacterActor.smallFormState) { otherCharacterActor.SetForm(otherCharacterActor.smallFormState); Debug.Log("small"); return(true); } else { otherCharacterActor.statusStateMachine.SetState(otherCharacterActor.deadStatusState); Debug.Log("dead"); return(true); } } } } return(false); }
public override bool DoInteracted(CharacterActor characterActor, Direction direction, GameObject interactor) { CharacterActor otherCharacterActor = interactor.GetComponent <CharacterActor>(); if (otherCharacterActor) { Collider2D collision = otherCharacterActor.thisInteractionCollider2D; // Stomp/Destroy enemies if they are below mario if (characterActor.IsBrainEnemy(otherCharacterActor.brain)) { if (Utilities.CheckOtherColliderDirection2D(Direction.Down, characterActor.thisInteractionCollider2D, collision)) { characterActor.movementStateMachine.PushState(characterActor.bounceMovementState); Destroy(otherCharacterActor.gameObject); return(true); } } } return(false); }