Exemplo n.º 1
0
 public void Attack(CharacterStats targetStats)
 {
     if (attackCooldown <= 0f)
     {
         if (isPlayer == false)
         {
             if (enermyAnimation != null)
             {
                 if (enermyAnimation.animator.GetCurrentAnimatorStateInfo(0).IsName("UD_infantry_07_attack_A"))
                 {
                     return;
                 }
                 enermyAnimation.AttackAnimation();
             }
         }
         if (isPlayer == true)
         {
             if (playerAnimation != null)
             {
                 if (playerAnimation.animator.GetCurrentAnimatorStateInfo(0).IsName("1HAttack"))
                 {
                     return;
                 }
                 playerAnimation.AttackAnimation(0);
             }
         }
         StartCoroutine(DoDamage(targetStats, delay));
         attackCooldown = 1f / attackSpeed;
     }
 }
Exemplo n.º 2
0
 public void Attack()
 {
     if (_rigid.velocity.y == 0)
     {
         _playerAnimation.AttackAnimation();
     }
 }
Exemplo n.º 3
0
    bool Attack()
    {
        bool        attacked = false;
        List <Tile> tileList = new List <Tile>();

        foreach (KeyValuePair <int, int> pair in m_Inventory.GetAttackPattern(m_MovementDirection))
        {
            tileList.Add(GetTileFromPair(pair, m_CurrentTile));
        }

        foreach (Tile tile in tileList)
        {
            AboveTileObject enemy = tile.Contains <Enemy>();
            if (enemy != null)
            {
                attacked = true;
                SoundManager.instance.PlaySound("sound_effect", "player_hit");
                SoundManager.instance.PlaySound("player", "mele");
                m_PlayerAnimation.AttackAnimation(m_MovementDirection);
                enemy.GetComponent <Enemy>().DestroyEnemy();
            }
        }

        return(attacked);
    }
Exemplo n.º 4
0
 void PlayerAttack()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Animator.AttackAnimation(); //Animation
         //do dmg
     }
 }
Exemplo n.º 5
0
 //Attack
 void Attack()
 {
     if (Input.GetKeyDown(KeyCode.LeftControl) && IsGrounded())
     {
         //Animation Idle -> Attack
         _playerAnimation.AttackAnimation();
     }
 }
Exemplo n.º 6
0
    public void Eat_Mode()
    {
        if (ps == PlayerState.Eat)
        {
            if (superComboMode_Count > maxCombo)
            {
                superComboMode_Count = maxCombo;
            }
            else
            {
                superComboMode_Count += 1f;
            }
            if (mainStage == false)
            {
                if (Random.Range(1, 101) <= criticalInt)
                {
                    damegeTextManager.ciriticalMode = true;
                    smallStageMenu_Setting.GetComponentInChildren <SmallStageMenu>().Damage(power * 2);
                }
                else
                {
                    smallStageMenu_Setting.GetComponentInChildren <SmallStageMenu>().Damage(power);
                }
            }
            else
            {
                if (Random.Range(1, 101) <= criticalInt)
                {
                    damegeTextManager.ciriticalMode = true;
                    mainFood_Setting.GetComponentInChildren <MainFood>().Damage(power * 2);
                }
                else
                {
                    mainFood_Setting.GetComponentInChildren <MainFood>().Damage(power);
                }
            }
            Food_Shot();
            playerAnimation.AttackAnimation();
            Destroy(smallFood_Setting.smallFood_Index[0]);
            Destroy(firstDishPoint);
            combo_Count += 1;
            startSmallFoodAnimation.SmallFoodAnimation();

            GameObject menuEffect = Instantiate(menu_Effect, Vector3.zero, Quaternion.identity) as GameObject;
            menuEffect.transform.SetParent(eat_Effect1.transform, false);
            menuEffect.transform.position = eat_Effect1.transform.position;

            GameObject eatEffect = Instantiate(eat_Effect, Vector3.zero, Quaternion.identity) as GameObject;
            eatEffect.transform.SetParent(eat_Transform.transform, false);
            eatEffect.transform.position = eat_Transform.transform.position;

            int randomGold = Random.Range(stage.mainStageCount, (stage.mainStageCount + stage.mainStageCount) + 1);
            if (goldGain == true)
            {
                randomGold = randomGold * 2;
            }
            else
            {
                randomGold = randomGold * 1;
            }
            gold          = gold + (randomGold * 2);
            goldText.text = CountModule(gold);
            GetComponent <AudioSource>().clip = eat_Sound;
            GetComponent <AudioSource>().Play();

            combo_system.combo_Strike();
        }
    }