Beispiel #1
0
 private void OnDestroy()
 {
     Log($"---------- {MethodBase.GetCurrentMethod().Name} ----------");
     UnitManager.RemoveUnit(this);
     DeleteSavedPath();
     CurrentGridBlock?.ResetCurrentUnit(this);
     Destroy(_minimapIcon);
     if (_cC != null)
     {
         _cC.OnCursorMoveEvent -= OnCursorMove;
     }
     IsDestroyed = true;
     Log("----------------------------------------");
 }
Beispiel #2
0
    public void MoveTo(List <GridBlock> movePoints, bool attackWhenInRange = false)
    {
        Log($"---------- {MethodBase.GetCurrentMethod().Name} ----------");
        Log($"Number of moves: {movePoints.Count}");
        if (CooldownTimer <= 0 && !Moved && movePoints.Count > 0)
        {
            _attackWhenInRange = attackWhenInRange;
            _tasked            = true; // Task has been given
            MeleeAttackedCount = 0;

            for (int x = 0; x < movePoints.Count; x++)
            {
                var point = movePoints[x];
                _movePositions.Enqueue(point);
            }

            Log("Moving");
            CurrentGridBlock.ResetCurrentUnit(this);
            GetNextPoint();
        }
        Log("----------------------------------------");
    }