示例#1
0
 public void VacateArea(RectInt area, string areaName)
 {
     foreach (Minion minion in minions)
     {
         if (!minion.hasWork && area.Contains(minion.pos))
         {
             JobTransient.AssignWork(minion, "MapVacate",
                                     new TaskGoTo(this, $"Vacating {areaName}.", PathCfg.Vacate(area)));
         }
     }
 }
示例#2
0
        public void AssignIdleTask(Minion minion)
        {
            const int   maxTries  = 10;
            const float maxWander = 16;

            for (int i = 0; i < maxTries; ++i)
            {
                float rad  = (float)rand.NextDouble() * maxWander;
                float deg  = (float)rand.NextDouble() * 360;
                var   roto = Quaternion.Euler(0, 0, deg);
                Vec2  vec  = roto * new Vec3(rad, 0, 0);
                Vec2  pt   = minion.pos + Vec2.one * .5f + vec;
                Vec2I tile = pt.Floor();
                if (game.ValidTile(tile) && tile != minion.pos && game.Tile(tile).passable)
                {
                    JobTransient.AssignIdleWork(minion, "IdleWanter", WanderTasks(tile));
                    break;
                }
            }
        }
示例#3
0
 public static void AssignFireAtRepeating(Game game, Minion minion, Vec2I target)
 => JobTransient.AssignWork(minion, "FireAtRepeat", GetTasks(game, minion, target));