Esempio n. 1
0
    private void Attack()
    {
        action = "Attack";
        Attack attack = new Attack();

        for (int i = 0; i < unitTurns[0].multistrike + 1; i++)
        {
            if (attack.AttackUnit(unitTurns[0]))
            {
                counter = 1.05f;
            }
            else
            {
                counter = 0.01f;
                break;
            }

            if (i == unitTurns[0].multistrike)
            {
                Bf.units[unitTurns[0].tile].rage = 0;
            }
        }

        unitTurns.RemoveAt(0);
    }
Esempio n. 2
0
 private void HandleRecievingDamage()
 {
     _grid.GetCell(_currentTargetX, _currentTargetY).GetOccupiedBy().GetUnitAnimations().AnimateUnit("HURT");
     _combatLog.LogCombat(Attack.AttackUnit(this, _grid.GetCell(_currentTargetX, _currentTargetY).GetOccupiedBy()));
     _grid.GetCell(_currentTargetX, _currentTargetY).GetOccupiedBy().SetHealth();
     _grid.GetCell(_currentTargetX, _currentTargetY).GetOccupiedBy().HandleDeath();
     EndAction(ActionType.Attack);
 }
Esempio n. 3
0
 void Update()
 {
     //Можно сделать задержку для поиска монтров
     if (target == null)
     {
         target = GetMonster();
     }
     else
     {
         attack.AttackUnit(target.GetComponent <Damaged>()); // Вообще эта фигня должна принимать IDamaged
     }
 }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (Physics.Raycast(this.transform.position, transform.forward, out hit, maxDistance: 10f))
        {
            if (hit.transform.name == target.transform.name && hit.distance < 1f)
            {
                agent.velocity  = Vector3.zero;
                agent.isStopped = true;
                attack.AttackUnit(target);
            }
        }
    }
Esempio n. 5
0
 protected static void KillThese(Unit[] units)
 {
     units = units.OrderBy(u1 => GetDistance(u1.X, u1.Y, GetData(() => Me.X), GetData(() => Me.Y))).ToArray();
     for (uint i = 0; i < units.Length; ++i)
     {
         var i1 = i;
         if (!GetBool(() => (units[i1].Valid && units[i1].Life > 0)))
         {
             continue;
         }
         Attack.AttackUnit(units[i]);
         Thread.Sleep(154);
     }
 }
Esempio n. 6
0
 protected void killThese(Unit[] _units)
 {
     //_units = _units.OrderBy(u1 => GetDistance(u1.X, u1.Y, Me.X, Me.Y)).ToArray();
     while (_units.Any())
     {
         _units = _units.Where(u => u.Valid).ToArray();
         if (!_units.Any())
         {
             break;
         }
         _units = _units.OrderBy(u1 => GetDistance(u1.X, u1.Y, Me.X, Me.Y)).ToArray();
         if (_units[0].Valid && _units[0].Life > 0)
         {
             Attack.AttackUnit(_units[0]);
             Thread.Sleep(154);
         }
     }
 }