Пример #1
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.J))
            {
                playerAnimation.Defend(true);
                shield.ActiveShield(true);
            }
            if (Input.GetKeyUp(KeyCode.J))
            {
                playerAnimation.UnFreezeAnimation();
                playerAnimation.Defend(false);

                shield.ActiveShield(false);
            }
            if (Input.GetKeyDown(KeyCode.K) || joyButton.isPressed && isAttack == false)
            {
                if (Random.Range(0, 2) > 0)
                {
                    playerAnimation.Attack_1();
                    isAttack = true;
                    soundFX.Attack_1();
                }
                else
                {
                    playerAnimation.Attack_2();
                    isAttack = true;
                    soundFX.Attack_2();
                }
            }
            else
            {
                isAttack = false;
            }
        }
    void Update()
    {
        //Defend input (key J)
        if (Input.GetKeyDown(KeyCode.J))
        {
            playerAnimation.Defend(true);

            shield.ActivateShield(true);
        }

        //Stop blocking with shield
        if (Input.GetKeyUp(KeyCode.J))
        {
            playerAnimation.UnFreezeAnimation();
            playerAnimation.Defend(false);

            shield.ActivateShield(false);
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            if (Random.Range(0, 2) > 0)
            {
                playerAnimation.Attack_1();

                soundFX.Attack_1();
            }
            else
            {
                playerAnimation.Attack_2();

                soundFX.Attack_2();
            }
        }
    }
Пример #3
0
    void AttackPlayer()
    {
        navAgent.velocity  = Vector3.zero;
        navAgent.isStopped = true;

        enemy_Anim.Walk(false);
        attack_Timer += Time.deltaTime;

        if (attack_Timer > wait_Before_Attack_Time)
        {
            if (Random.Range(0, 2) > 0)
            {
                enemy_Anim.Attack_1();
                soundFX.Attack_1();
            }
            else
            {
                enemy_Anim.Attack_2();
                soundFX.Attack_2();
            }

            attack_Timer = 0f;
        }

        if (Vector3.Distance(transform.position, playerTarget.position) >
            attack_Distance + chase_Player_After_Attack_Distance)
        {
            navAgent.isStopped = false;
            enemy_State        = EnemyState.CHASE;
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        // defend when press J
        if (Input.GetKeyDown(KeyCode.J))
        {
            playerAnimation.Defend(true);
            shield.ActiveShield(true);
        }
        // release when J unpressed
        if (Input.GetKeyUp(KeyCode.J))
        {
            playerAnimation.UNFreezeAnimation();
            playerAnimation.Defend(false);
            shield.ActiveShield(false);
        }

        // Attack when press K
        if (Input.GetKeyDown(KeyCode.K))
        {
            if (Random.Range(0, 2) > 0)
            {
                playerAnimation.Attack1();
                soundFX.Attack_1();
            }
            else
            {
                playerAnimation.Attack2();
                soundFX.Attack_2();
            }
        }
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Y))
        {
            playerAnimation.Defend(true);

            shield.ActivateShield(true);
        }

        if (Input.GetKeyUp(KeyCode.Y))
        {
            playerAnimation.UnFreezeAnimation();
            playerAnimation.Defend(false);

            shield.ActivateShield(false);
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            if (Random.Range(0, 2) > 0)
            {
                playerAnimation.Attack_1();
                soundFX.Attack_1();
            }
            else
            {
                playerAnimation.Attack_2();

                soundFX.Attack_2();
            }
        }
    }
Пример #6
0
 public void Attack(CharacterAnimations animations)
 {
     if (Random.Range(0, 2) > 0)
     {
         animations.Attack_1();
         soundFX.Attack_1();
     }
     else
     {
         animations.Attack_2();
         soundFX.Attack_2();
     }
 }