Exemplo n.º 1
0
    private void OnTriggerPressed(object sender, ControllerInteractionEventArgs e)
    {
        // Debug.Log(hand.ToString() + " trigger pressed");

        // Can't do stuff while teleporting.
        if (mover.IsTeleporting)
        {
            return;
        }

        if (hand == Hands.LEFT)
        {
            if (flyer.FlightState == PlayerFlyer.FlightStates.GROUNDED)
            {
                // Start attacking.
                attacker.Attack();
            }
            else if (flyer.FlightState == PlayerFlyer.FlightStates.FLYING)
            {
                // Start painting dig tiles.
                SetPointer(true, PointerTypes.STRAIGHT);

                digger.Dig(destinationArgs);
            }
        }
        else if (hand == Hands.RIGHT)
        {
            if (flyer.FlightState == PlayerFlyer.FlightStates.GROUNDED)
            {
                grabber.Grab();

                // If grabbing failed, we're allowed to summon.
                if (!grabber.IsGrabbing)
                {
                    // Start summoning.
                    SetPointer(true);

                    summoner.Summon();
                }
            }
        }
    }