Exemplo n.º 1
0
    public override bool DoInteracted(PowerupActor powerupActor, Direction direction, GameObject interactor)
    {
        CharacterActor otherCharacterActor = interactor.transform.root.GetComponent <CharacterActor>();

        if (otherCharacterActor)
        {
            // Empower buffables upon contact
            if (powerupActor.IsBrainBuffable(otherCharacterActor.brain))
            {
                if (otherCharacterActor.formStateMachine.currentState == otherCharacterActor.smallFormState)
                {
                    otherCharacterActor.SetForm(otherCharacterActor.bigFormState);
                    Destroy(powerupActor.gameObject);
                    return(true);
                }
                else if (otherCharacterActor.formStateMachine.currentState == otherCharacterActor.bigFormState)
                {
                    otherCharacterActor.SetForm(otherCharacterActor.powerFormState);
                    Destroy(powerupActor.gameObject);
                    return(true);
                }
            }
        }

        return(false);
    }
Exemplo n.º 2
0
            public override void DoFixedUpdate(PowerupActor owner)
            {
                //owner.thisRigidbody2D.AddForce(owner.moveDirection * owner.moveSpeed * Time.fixedDeltaTime);

                if (owner.thisCharacter2D.isChangingDirection)
                {
                    owner.thisRigidbody2D.velocity = new Vector2(0f, owner.thisRigidbody2D.velocity.y);
                }

                owner.thisCharacter2D.Move(owner.moveDirection * owner.moveSpeed * Time.fixedDeltaTime);
            }
 public override void DoStart(PowerupActor actor)
 {
     actor.movementStateMachine.SetState(actor.moveMovementState);
 }