示例#1
0
    // Update is called once per frame
    void Update()
    {
        playerStatus.OnUpdate();

        if (Input.anyKey)
        {
            foreach (KeyCode code in Enum.GetValues(typeof(KeyCode)))
            {
                if (Input.GetKey(code))
                {
                    switch (code)
                    {
                    case KeyCode.W:
                    case KeyCode.A:
                    case KeyCode.S:
                    case KeyCode.D:
                        ChangeStatus(EPlayerState.Run);
                        break;

                    default:
                        ChangeStatus(EPlayerState.Idle);
                        break;
                    }
                }
                if (Input.GetKeyDown(code))
                {
                    switch (code)
                    {
                    case KeyCode.V:
                        ChangeStatus(EPlayerState.Atk, code);
                        StartCoroutine(EffectPlayer.Instance.ShotMagicEffect("EnergeBlast", target.transform.position));
                        break;

                    case KeyCode.X:
                        ChangeStatus(EPlayerState.Atk, code);
                        StartCoroutine(EffectPlayer.Instance.ShotMagicEffect("FireShot", target.transform.position));
                        break;

                    case KeyCode.C:
                        ChangeStatus(EPlayerState.Atk, code);
                        StartCoroutine(EffectPlayer.Instance.ShotMagicEffect("FrameBall", target.transform.position));
                        break;

                    case KeyCode.B:
                        ChangeStatus(EPlayerState.Atk, code);
                        StartCoroutine(EffectPlayer.Instance.ShotMagicEffect("GreenCore", target.transform.position));
                        break;

                    case KeyCode.Space:
                        ChangeStatus(EPlayerState.Jump);
                        break;

                    default:
                        ChangeStatus(EPlayerState.Idle);
                        break;
                    }
                }
            }
        }
        else
        {
            ChangeStatus(EPlayerState.Idle);
        }
    }