Beispiel #1
0
    /// <summary>
    /// Determina la acción a realizar.
    /// Segun el input y las posibilidades a partir de los cubos que lo rodean.
    /// </summary>
    protected void StartAction()
    {
        // Esta colgado
        if (_actionState == ActionState.Hanging)
        {
            // Si no hay input
            if (!_input.HasInput())
            {
                Hang();
            }

            // Hay input
            else
            {
                HangingManagement();
            }
        }

        // Esta agarrando un bloque
        else if (_actionState == ActionState.Gripping)
        {
            // Si suelta el boton de agarre
            if (!_input.BtnA)
            {
                Debug.Log("Accion: Soltando bloque (no hay input)");
                ReleaseGrip();
            }

            // Hay input de boton de agarre (al menos)
            else
            {
                GrippingManagement();
            }
        }

        // Esta parado
        else if (_actionState == ActionState.Standing)
        {
            // Si no hay input
            if (!_input.HasInput())
            {
                Stand();
            }

            // Hay input
            else
            {
                // Hay input de boton de agarre
                if (_input.BtnA)
                {
                    GrippingManagement();
                }

                // Sigue estando parado
                if (_actionState == ActionState.Standing)
                {
                    // Hay input de direccion
                    if (_input.Direction != null)
                    {
                        LocomotionManagement();
                    }

                    // No hay input de direccion
                    else
                    {
                        // Se queda parado
                        Stand();
                    }
                }
            }
        }

        // Borra el input almacenado
        _input.Empty();
    }