예제 #1
0
        public void DoNext(Player _player)
        {
            player = _player;
            if (group == null)
            {
                foreach (Group g in MyAI.arrGroup)
                {
                    if (!g.hasGuard)
                    {
                        g.hasGuard = true;
                        group      = g;
                        g.Guard    = this;
                        break;
                    }
                }
            }
            if (group == null) // kalo masih null juga -> bot baru dibuat setelah salah satu hancur
            {
                foreach (NanoBot bot in _player.NanoBots)
                {
                    if (bot is GuardBot)
                    {
                        ((GuardBot)bot).group = null;
                    }
                }
                foreach (Group g in MyAI.arrGroup)
                {
                    g.Guard    = null;
                    g.hasGuard = false;
                }
                return;
            }

            HandleEnemies();
            HandleDestinationChange();

            if (this.State == NanoBotState.WaitingOrders)
            {
                this.GuardState = GuardBotState.idle;
                this.MoveTo(Global.PF.FindWay(this.Location, group.ActiveDestination).Points);
            }
        }
예제 #2
0
        public void DoNext(Player _player)
        {
            player = _player;
            if (group == null)
            {
                foreach (Group g in MyAI.arrGroup)
                {
                    if (!g.hasGuard)
                    {
                        g.hasGuard = true;
                        group = g;
                        g.Guard = this;
                        break;
                    }
                }
            }
            if (group == null) // kalo masih null juga -> bot baru dibuat setelah salah satu hancur
            {
                foreach (NanoBot bot in _player.NanoBots)
                {
                    if (bot is GuardBot)
                    {
                        ((GuardBot)bot).group = null;
                    }
                }
                foreach (Group g in MyAI.arrGroup)
                {
                    g.Guard = null;
                    g.hasGuard = false;
                }
                return;
            }

            HandleEnemies();
            HandleDestinationChange();

            if (this.State == NanoBotState.WaitingOrders)
            {
                this.GuardState = GuardBotState.idle;
                this.MoveTo(Global.PF.FindWay(this.Location, group.ActiveDestination).Points);
            }
        }