Example #1
0
    /// <summary>
    /// When it is detected that players have interacted with one of the 5 options, they both determine their results here.
    /// </summary>
    private void ResolveInteraction()
    {
        switch (opponent.GetState())
        {
        case RobotState.Punching:
            if (state == RobotState.Dodging || state == RobotState.Shooting)
            {
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Posing || state == RobotState.Reflecting || state == RobotState.Idle)
            {
                lockTime = 1f;
                state    = RobotState.Hurt;
                TriggerAnimation();
                audioSource.PlayOneShot(punchHitSounds[Random.Range(0, punchHitSounds.Length)]);
            }
            else if (state == RobotState.Punching)
            {
                punchBox.SetActive(false);
                //Play impact sound
            }
            break;

        case RobotState.Shooting:
            if (state == RobotState.Dodging)
            {
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Reflecting)
            {
                //REVERSE SHOT
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Posing || state == RobotState.Punching || state == RobotState.Idle)
            {
                lockTime = 1f;
                state    = RobotState.Hurt;
                TriggerAnimation();
            }
            break;

        case RobotState.Dodging:
            if (state == RobotState.Reflecting || state == RobotState.Posing)
            {
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Shooting || state == RobotState.Punching)
            {
                lockTime = 1f;
            }
            break;

        case RobotState.Reflecting:
            if (state == RobotState.Posing || state == RobotState.Punching)
            {
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Dodging)
            {
                lockTime = 1f;
            }
            else if (state == RobotState.Shooting)
            {
                lockTime = 1f;
                state    = RobotState.Hurt;
                TriggerAnimation();
            }
            break;

        case RobotState.Posing:
            if (state == RobotState.Punching || state == RobotState.Shooting)
            {
                lockTime = 1f;
                GainStyle();
            }
            else if (state == RobotState.Reflecting || state == RobotState.Dodging)
            {
                lockTime = 1f;
            }
            break;

        case RobotState.Idle:
            if (state == RobotState.Punching || state == RobotState.Shooting)
            {
                lockTime = 1f;
                GainStyle();
            }
            break;

        case RobotState.Hurt:
            lockTime = 1f;
            GainStyle();
            break;
        }
    }