Beispiel #1
0
        void DoBuild(Buildable elt, bool cancel)
        {
            if (cancel)
            {
                testshit.StopCommand(GetComponent <EntityMirror>());
                return;
            }
            if (component.buildInProgress && component.currentMode == Game.BuildMode.BUILD_THEN_PLACE && component.remainingTime <= 0)
            {
                if (elt.id != component.buildingWhat)
                {
                    return;
                }
                testshit.BeginPlacement(elt.name,
                                        point => testshit.DeployCommand(GetComponent <EntityMirror>(), point),
                                        point => component.CheckBuildPlacement(component.buildingWhat, (Game.DVector3)point),
                                        () => {});
                return;
            }

            var mode = Game.World.current.entityPrototypes[elt.name].BuildMode();

            if (mode == Game.BuildMode.BUILD_IN_PLACE ||
                mode == Game.BuildMode.BUILD_IMMEDIATE)
            {
                testshit.BeginPlacement(elt.name,
                                        point => testshit.BuildCommand(GetComponent <EntityMirror>(), elt.id, point),
                                        point => component.CheckBuildPlacement(elt.id, (Game.DVector3)point) && component.HaveEnoughResources(elt.id),
                                        () => {});
            }
            else
            {
                testshit.BuildCommand(GetComponent <EntityMirror>(), elt.id, Vector3.zero);
            }
        }
Beispiel #2
0
        void Start()
        {
            testshit   = Object.FindObjectOfType <Testshit>();
            ui_manager = Object.FindObjectOfType <ListController>();

            deployUiElement = ui_manager.AddUiElement(
                Resources.Load <Sprite>("Sprites/" + component.deployPrototype),
                component.deployPrototype,
                cancel => {
                if (!cancel)
                {
                    testshit.DeployCommand(GetComponent <EntityMirror>(),
                                           // Truck deploys in place.
                                           Vector3.zero);
                }
            });
        }
Beispiel #3
0
        void Start()
        {
            testshit   = Object.FindObjectOfType <Testshit>();
            ui_manager = Object.FindObjectOfType <ListController>();

            deployUiElement = ui_manager.AddUiElement(
                Resources.Load <Sprite>("Sprites/" + component.towerPrototype),
                component.towerPrototype,
                cancel => {
                if (!cancel)
                {
                    testshit.BeginPlacement(component.towerPrototype,
                                            point => testshit.DeployCommand(GetComponent <EntityMirror>(), point),
                                            point => component.CheckBuildPlacement((Game.DVector3)point),
                                            () => {});
                }
            });
        }