예제 #1
0
        public void Attack()
        {
            if (actionAllowed)
            {
                bool executedAttack = false;

                if (weapon.melee)
                {
                    var defenderCoordinate = this.position + this.lookDirection;
                    if (room.HasAgent(defenderCoordinate))
                    {
                        executedAttack = MeleeSystem.Execute(this, room.GetAgent(defenderCoordinate));
                    }
                }
                else if (weapon.Shoot(_stats.position, _stats.lookDirection))
                {
                    executedAttack = true;
                }

                if (executedAttack)
                {
                    _stats.shots++;
                    actionPoints--;
                    actionTick();
                }
            }
        }
예제 #2
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else if (_instance != this)
     {
         Destroy(this);
     }
 }
예제 #3
0
 static void Spawn()
 {
     _instance = Tower.T.gameObject.AddComponent <MeleeSystem>();
 }