コード例 #1
0
 public void attack()
 {
     target = Random.Range(0, 2);
     if (target == 0)
     {
         ps.loseHP(ms.getAttackDamage());
     }
     else if (target == 1)
     {
         monster = GameObject.FindGameObjectWithTag(monsterStr);
         if (monster != null)
         {
             msEnemy = monster.GetComponent <MonsterStats>();
             msEnemy.loseHP(ms.getAttackDamage());
         }
         else
         {
             ps.loseHP(ms.getAttackDamage());
         }
     }
 }