예제 #1
0
        } // Update

        public void ScanForTarget(GameTime gameTime)
        {
            NextDefendScan -= (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (NextDefendScan <= 0)
            {
                NextDefendScan = 0;

                var newTarget = AIHelper.FindClosestDamagedFriend(this);

                if (newTarget != null)
                {
                    var repair = StateMachine.GetState <RepairShipRepairState>();
                    repair.Target     = newTarget;
                    repair.RepairRate = RepairRate;
                    StateMachine.SetState(repair);
                }
                else
                {
                    NextDefendScan = DefendScanFrequency;
                }
            }
        } // ScanForTarget