예제 #1
0
        protected void ProcessSpawnQueue()
        {
            currentSpawnProgress += spawnIncrement;
            if (currentSpawnProgress > _maxSpawnProgress)
            {
                if (Agent.GetCommander())
                {
                    //if (audioElement != null)
                    //{
                    //    audioElement.Play(finishedJobSound);
                    //}
                    Vector2d spawnOutside = new Vector2d(this.transform.position);
                    RTSAgent agent        = Agent.Controller.CreateAgent(spawnQueue.Dequeue(), spawnOutside);
                    agent.SetProvision(true);

                    if (cachedRally)
                    {
                        if (cachedRally.spawnPoint != cachedRally.rallyPoint)
                        {
                            Command moveCom = new Command(AbilityDataItem.FindInterfacer("Move").ListenInputID);
                            moveCom.Add <Vector2d>(new Vector2d(cachedRally.rallyPoint));
                            moveCom.ControllerID = agent.Controller.ControllerID;
                            moveCom.Add <Influence>(new Influence(agent));

                            CommandManager.SendCommand(moveCom);
                        }
                    }
                }
                currentSpawnProgress = 0;
            }
        }