public virtual void AI(Player ENEMY, SquareGrid GRID) { rePathTimer.UpdateTimer(); if (pathNodes == null || (pathNodes.Count == 0 && pos.X == moveTo.X && pos.Y == moveTo.Y) || rePathTimer.Test()) { if (!currentlyPathing) { Task repathTask = new Task(() => { currentlyPathing = true; pathNodes = FindPath(GRID, GRID.GetSlotFromPixel(ENEMY.hero.pos, Vector2.Zero)); moveTo = pathNodes[0]; pathNodes.RemoveAt(0); rePathTimer.ResetToZero(); currentlyPathing = false; }); repathTask.Start(); } } else { MoveUnit(); if (Globals.GetDistance(pos, ENEMY.hero.pos) < GRID.slotDims.X * 1.2f) { ENEMY.hero.GetHit(this, 1); dead = true; } } }
public virtual void Update() { sortTimer.UpdateTimer(); if (sortTimer.Test()) { Sort(); sortTimer.ResetToZero(); } }
public override void Update(Vector2 OFFSET, Player ENEMY, SquareGrid GRID) { spawnTimer.UpdateTimer(); if (spawnTimer.Test()) { SpawnMob(); spawnTimer.ResetToZero(); } base.Update(OFFSET, ENEMY, GRID); }