Пример #1
0
 void CheckInPut()
 {
     if ((Control.GetKey("Attack") || Input.GetKey(KeyCode.X)) && WeaponCurrent != null && PermitAttack)
     {
         Attack();
     }
     else
     {
         if (Control.GetKey("Attack") || Input.GetKey(KeyCode.X) && PermitAttack)
         {
             Debug.Log("Chưa trang vị vũ khí");
         }
         else
         {
             OnNotAttack?.Invoke();
         }
     }
     if (PermitSkill)
     {
         if (skills != null && skills.Count != 0)
         {
             foreach (SkillConnect skill in skills)
             {
                 if (skill.skill != null && skill.skill.isReady)
                 {
                     if (Control.GetKeyDown(skill.CodeControl))
                     {
                         skill.skill.StartSkill();
                     }
                 }
             }
         }
     }
 }
Пример #2
0
    void Attack()
    {
        DamageData damageData = new DamageData();

        SetUpDamageData(damageData);
        if (WeaponCurrent.Attack(damageData.Clone))
        {
            OnAttacked?.Invoke();
        }
        else
        {
            OnNotAttack?.Invoke();
        }
    }