コード例 #1
0
    //CastingSpell, ActivatingBuff, Neutral, Moving, Dashing, Attacking,
    //    Jumping, JumpAttacking, TakingDamage

    public void UpdateAnimations(Helper.PlayerStatus playerStatus)
    {
        //update based on playerStatus
        switch (playerStatus)
        {
        case Helper.PlayerStatus.Attacking:
            CharacterToPunchAnimation();
            break;

        case Helper.PlayerStatus.ActivatingBuff:
            CharacterToBuffAnimation();
            break;

        case Helper.PlayerStatus.Jumping:
            CharacterToJumpAnimation();
            break;

        case Helper.PlayerStatus.Moving:
            CharacterToMoveAnimation();
            break;

        case Helper.PlayerStatus.Dashing:
            CharacterToDashAnimation();
            break;

        default:
            CharacterToNeutralAnimation();
            break;
        }
    }
コード例 #2
0
    private void DoCharacterMovement()
    {
        if (!PlayerMovementDisabled())
        {
            var xMovement = Input.GetAxis("Horizontal");
            var yMovement = Input.GetAxis("Vertical");

            if ((xMovement != 0 || yMovement != 0))
            {
                if (Input.GetButton("Fire3"))
                {
                    Run(xMovement, yMovement);
                }
                else
                {
                    Walk(xMovement, yMovement);
                }
            }
            else
            {
                if (IsGrounded())
                {
                    _playerStatus = Helper.PlayerStatus.Neutral;
                }
            }
        }
    }
コード例 #3
0
    void Start()
    {
        _buffManager = gameObject.AddComponent <BuffManager>();


        distToGround  = GetComponent <Collider>().bounds.extents.y;
        _playerStatus = Helper.PlayerStatus.Neutral;
    }
コード例 #4
0
 private void Jump()
 {
     if (IsGrounded())
     {
         _playerStatus = Helper.PlayerStatus.Jumping;
         GetComponent <Rigidbody>().AddForce(new Vector3(0, _jumpForce, 0), ForceMode.Impulse);
     }
 }
コード例 #5
0
    private IEnumerator CastingMeteor(Attack pAttack)
    {
        while (true)
        {
            yield return(new WaitForSeconds(_abilityActivationRate));

            _playerStatus = Helper.PlayerStatus.Neutral;
            StopCoroutine(_castingCoroutine);
        }
    }
コード例 #6
0
    private IEnumerator ActivatingAbility(string ability)
    {
        while (true)
        {
            yield return(new WaitForSeconds(_abilityActivationRate));

            _playerStatus = Helper.PlayerStatus.Neutral;
            StopCoroutine(_buffingCoroutine);
            _buffManager.ManagerBuffPlayer(ability);
        }
    }
コード例 #7
0
    private IEnumerator TakeDamage(float duration)
    {
        while (true)
        {
            yield return(new WaitForSeconds(duration));

            _playerStatus = Helper.PlayerStatus.Neutral;
            StopCoroutine(_damageCoroutine);
            _damageCoroutine       = null;
            _invulnerableCoroutine = StartCoroutine(InvulnerabilityFrames());
        }
    }
コード例 #8
0
    private void Run(float xMovement, float yMovement)
    {
        var x = xMovement * Time.deltaTime * (maxSpeedX * speed * 2);
        var z = yMovement * Time.deltaTime * (maxSpeedZ * speed * 2);

        DetermineFlipSprite(x);
        Vector3 movement = new Vector3(x, 0.0f, z);

        GetComponent <Rigidbody>().transform.Translate(movement);
        if (IsGrounded())
        {
            _playerStatus = Helper.PlayerStatus.Dashing;
        }
    }
コード例 #9
0
    private void ProcessAbilityInput()
    {
        if (AbilityMenuIsActive() && _buffManager.ManagerCanBuffPlayer())
        {
            if (Input.GetButtonDown("Fire3"))
            {
                _playerStatus = Helper.PlayerStatus.ActivatingBuff;
                AbilityOne();
            }

            if (Input.GetButtonDown("Fire2"))
            {
                AbilityOne();
            }
        }
    }
コード例 #10
0
 private void AttackMeteor(Attack pAttack)
 {
     _playerStatus     = Helper.PlayerStatus.CastingSpell;
     _castingCoroutine = StartCoroutine(CastingMeteor(pAttack));
 }