Ejemplo n.º 1
0
 public Command_Spawn(Vectangle bounds, ChemicalFactory factory, int inputIndex)
 {
     triggered       = false;
     this.bounds     = bounds;
     this.factory    = factory;
     this.inputIndex = inputIndex;
 }
Ejemplo n.º 2
0
        public void Run()
        {
            incomePerSecond = 0;
            foreach (CityObject obj in objects)
            {
                obj.Run();

                ChemicalFactory factory = obj as ChemicalFactory;
                if (factory != null)
                {
                    incomePerSecond += factory.incomePerSecond;
                }

                foreach (OutputPipe pipe in obj.pipes)
                {
                    pipe.Run();
                }
            }
        }
Ejemplo n.º 3
0
        public override void Update(CityUIBlackboard blackboard)
        {
            Rectangle dragBoxRect = GetDragBox();

            if (selected && numCores > DEFAULT_NUM_CORES && dragBoxRect.Contains(blackboard.inputState.MousePos) && blackboard.inputState.WasMouseLeftJustPressed())
            {
                // unmerging a previously merged factory
                numCores -= DEFAULT_NUM_CORES;
                UpdateThreads();
                ChemicalFactory newFactory = new ChemicalFactory(cityLevel, blackboard.inputState.MousePos, true, false);
                blackboard.cityLevel.AddObjectDeferred(newFactory);
                blackboard.selectedObject = newFactory;
                return;
            }

            base.Update(blackboard);

            showErrorMessage = false;

            if (selected)
            {
                ui.origin = bounds.Origin;
                ui.Update(blackboard.inputState);
            }

            if (blackboard.inputState.hoveringElement == this &&
                GetWarningRect().Contains(blackboard.inputState.MousePos))
            {
                showErrorMessage = true;
            }

            /*
             * if (blackboard.selectedObject != null
             *  && blackboard.selectedObject != this
             *  && blackboard.selectedObject is ChemicalFactory
             *  && blackboard.selectedObject.dragging
             *  && GetDragBox().Contains(blackboard.inputState.MousePos))
             * {
             *  blackboard.draggingOntoObject = this;
             * }*/
        }
Ejemplo n.º 4
0
 public void Open(ChemicalFactory factory)
 {
     this.factory = factory;
     InitObjects();
 }
Ejemplo n.º 5
0
 public void ViewFactory(ChemicalFactory factory)
 {
     platformLevel.Open(factory);
     this.currentScreen = platformLevel;
 }