protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOn(); this.PlaceObjectTo(new int2(4, 4), ll); LightsControl lc = new LightsControl(); lc.TurnOn(); lc.myObjects.Add(ll); this.PlaceObjectTo(new int2(1, 1), lc); LightsControl lc2 = new LightsControl(); lc2.TurnOn(); lc2.myObjects.Add(ll); this.PlaceObjectTo(new int2(3, 3), lc2); LightsControl lc3 = new LightsControl(); lc3.TurnOn(); lc3.myObjects.Add(ll); this.PlaceObjectTo(new int2(2, 2), lc3); StaticObjects = new MyStaticObject[4]; StaticObjects[0] = ll; StaticObjects[1] = lc; StaticObjects[2] = lc2; StaticObjects[3] = lc3; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOff(); this.PlaceObjectTo(new int2(5, 5), ll); /* * Lights lll = new Lights(); * lll.TurnOff(); * this.PlaceObjectTo(new int2(2, 5), lll); * * Lights llll = new Lights(); * llll.TurnOff(); * this.PlaceObjectTo(new int2(2, 2), llll); * */ LightsControl lc = new LightsControl(); lc.TurnOff(); lc.myObjects.Add(ll); this.PlaceObjectTo(new int2(1, 1), lc); MyDoor door2 = new MyDoor(); door2.TurnOff(); this.PlaceObjectTo(new int2(5, 1), door2); DoorControl dc = new DoorControl(); dc.myObjects.Add(door2); this.PlaceObjectTo(new int2(1, 5), dc); StaticObjects = new MyStaticObject[] { ll, lc, door2, dc };//,lll,llll}; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOn(); this.PlaceObjectTo(new int2(6, 0), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(ll); lc.TurnOn(); this.PlaceObjectTo(new int2(1, 1), lc); // lights control Lights llX = new Lights(); llX.TurnOn(); this.PlaceObjectTo(new int2(6, 9), llX); LightsControl lcX = new LightsControl(); lcX.myObjects.Add(llX); lcX.TurnOn(); this.PlaceObjectTo(new int2(9, 9), lcX); // place into the map MyDoor doorX = new MyDoor(); doorX.TurnOff(); this.PlaceObjectTo(new int2(8, 6), doorX); DoorControl doorControlX = new DoorControl(); doorControlX.myObjects.Add(doorX); doorControlX.TurnOff(); this.PlaceObjectTo(new int2(4, 7), doorControlX); // door 2 with two controls MyDoor door2 = new MyDoor(); door2.TurnOff(); this.PlaceObjectTo(new int2(5, 5), door2); DoorControl dc = new DoorControl(); //dc.myObjects.Add(door); dc.myObjects.Add(door2); dc.TurnOff(); this.PlaceObjectTo(new int2(1, 8), dc); DoorControl dc2 = new DoorControl(); //dc2.myObjects.Add(door); dc2.myObjects.Add(door2); dc2.TurnOff(); this.PlaceObjectTo(new int2(8, 1), dc2); StaticObjects = new MyStaticObject[] { dc, dc2, door2, doorX, doorControlX, lcX, llX, ll, lc }; }
/// <summary> /// InitializeSystem - this method gets called after the constructor /// has finished. /// /// Use InitializeSystem to: /// * Start threads /// * Configure ports, such as serial and verisports /// * Start and initialize socket connections /// Send initial device configurations /// /// Please be aware that InitializeSystem needs to exit quickly also; /// if it doesn't exit in time, the SIMPL#Pro program will exit. /// </summary> public override void InitializeSystem() { try { lightsControl = LightsControl.GetInstance(eisc); lightsControl.Initialize(); lightsControlUI.Initialize(); } catch (Exception e) { ErrorLog.Error("Error in InitializeSystem: {0}", e.Message); } }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOff(); this.PlaceObjectTo(new int2(5, 5), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(ll); lc.TurnOff(); this.PlaceObjectTo(new int2(1, 1), lc); Lights lll = new Lights(); lll.TurnOn(); this.PlaceObjectTo(new int2(2, 5), lll); LightsControl lcc = new LightsControl(); lcc.myObjects.Add(lll); lcc.TurnOn(); this.PlaceObjectTo(new int2(4, 7), lcc); MyDoor door = new MyDoor(); door.TurnOff(); this.PlaceObjectTo(new int2(5, 1), door); DoorControl dc = new DoorControl(); dc.myObjects.Add(door); dc.TurnOff(); this.PlaceObjectTo(new int2(7, 7), dc); MyDoor door2 = new MyDoor(); door2.TurnOn(); this.PlaceObjectTo(new int2(7, 4), door2); DoorControl dc2 = new DoorControl(); dc2.myObjects.Add(door); dc2.TurnOn(); this.PlaceObjectTo(new int2(2, 8), dc2); StaticObjects = new MyStaticObject[] { ll, lc, lll, lcc, door2, dc2, door, dc }; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOn(); this.PlaceObjectTo(new int2(3, 9), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(ll); lc.TurnOn(); this.PlaceObjectTo(new int2(1, 1), lc); StaticObjects = new MyStaticObject[2]; StaticObjects[0] = ll; StaticObjects[1] = lc; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOn(); this.PlaceObjectTo(new int2(7, 7), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(ll); lc.TurnOn(); this.PlaceObjectTo(new int2(1, 1), lc); /* * // place into the map * Door door = new Door(); * door.turnOff(); * this.placeObjectTo(new int2(5, 4), door); */ MyDoor door2 = new MyDoor(); door2.TurnOff(); this.PlaceObjectTo(new int2(5, 5), door2); /* * DoorControl dc = new DoorControl(); * //dc.myObjects.Add(door); * dc.myObjects.Add(door2); * this.PlaceObjectTo(new int2(1, 8), dc); */ DoorControl dc2 = new DoorControl(); //dc2.myObjects.Add(door); dc2.myObjects.Add(door2); dc2.TurnOff(); this.PlaceObjectTo(new int2(8, 1), dc2); StaticObjects = new MyStaticObject[] { ll, lc, dc2, door2 }; }
protected override void DefineStaticObjects() { // place into the map MyDoor door = new MyDoor(); door.TurnOff(); this.PlaceObjectTo(new int2(12, 5), door); DoorControl dc = new DoorControl(); dc.myObjects.Add(door); dc.TurnOff(); this.PlaceObjectTo(new int2(9, 9), dc); DoorControl dc2 = new DoorControl(); dc2.myObjects.Add(door); dc2.TurnOff(); this.PlaceObjectTo(new int2(10, 1), dc2); Lights l = new Lights(); l.TurnOff(); this.PlaceObjectTo(new int2(5, 5), l); Lights ll = new Lights(); ll.TurnOff(); this.PlaceObjectTo(new int2(1, 1), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(l); lc.myObjects.Add(ll); lc.TurnOff(); this.PlaceObjectTo(new int2(6, 6), lc); StaticObjects = new MyStaticObject[] { dc, door, dc2, lc, l, ll }; }
protected override void DefineStaticObjects() { // place into the map MyDoor door = new MyDoor(); door.TurnOn(); this.PlaceObjectTo(new int2(2, 3), door); DoorControl dc = new DoorControl(); dc.myObjects.Add(door); dc.TurnOn(); this.PlaceObjectTo(new int2(11, 7), dc); MyDoor door2 = new MyDoor(); door2.TurnOn(); this.PlaceObjectTo(new int2(7, 7), door2); DoorControl dc2 = new DoorControl(); dc2.myObjects.Add(door2); dc2.TurnOn(); this.PlaceObjectTo(new int2(12, 3), dc2); Lights l = new Lights(); l.TurnOff(); this.PlaceObjectTo(new int2(3, 7), l); LightsControl lc = new LightsControl(); lc.myObjects.Add(l); lc.TurnOff(); this.PlaceObjectTo(new int2(0, 0), lc); StaticObjects = new MyStaticObject[] { dc, door, door2, dc2, l, lc }; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOn(); this.PlaceObjectTo(new int2(7, 7), ll); LightsControl lc = new LightsControl(); lc.myObjects.Add(ll); lc.TurnOn(); this.PlaceObjectTo(new int2(1, 1), lc); /* // place into the map Door door = new Door(); door.turnOff(); this.placeObjectTo(new int2(5, 4), door); */ MyDoor door2 = new MyDoor(); door2.TurnOff(); this.PlaceObjectTo(new int2(5, 5), door2); /* DoorControl dc = new DoorControl(); //dc.myObjects.Add(door); dc.myObjects.Add(door2); this.PlaceObjectTo(new int2(1, 8), dc); */ DoorControl dc2 = new DoorControl(); //dc2.myObjects.Add(door); dc2.myObjects.Add(door2); dc2.TurnOff(); this.PlaceObjectTo(new int2(8, 1), dc2); StaticObjects = new MyStaticObject[] { ll, lc, dc2, door2 }; }
protected override void DefineStaticObjects() { Lights ll = new Lights(); ll.TurnOff(); this.PlaceObjectTo(new int2(4, 4), ll); /* Lights lll = new Lights(); lll.TurnOff(); this.PlaceObjectTo(new int2(2, 5), lll); Lights llll = new Lights(); llll.TurnOff(); this.PlaceObjectTo(new int2(2, 2), llll); */ LightsControl lc = new LightsControl(); lc.TurnOff(); lc.myObjects.Add(ll); this.PlaceObjectTo(new int2(2, 2), lc); MyDoor door2 = new MyDoor(); door2.TurnOff(); this.PlaceObjectTo(new int2(4, 2), door2); DoorControl dc = new DoorControl(); dc.myObjects.Add(door2); this.PlaceObjectTo(new int2(2, 4), dc); StaticObjects = new MyStaticObject[] { ll, lc, door2, dc };//,lll,llll}; }
protected bool ResolveCustomActions(MyMovingObject agent, Tale[,] tales, AGENT_ACTIONS action) { bool result = false; Tale t; if (action == AGENT_ACTIONS.BASIC) { t = tales[agent.GetPosition().x, agent.GetPosition().y]; for (int i = 0; i < t.Objects.Count; i++) { if (t.Objects[i] is TwoStateObjectControl) { if (t.Objects[i] is DoorControl) { if (!pars.ForceDoorSwitches) { ((DoorControl)t.Objects[i]).applyPressAction(); result = true; } } else if (t.Objects[i] is LightsControl) { if (!pars.ForceLightSwitches) { ((LightsControl)t.Objects[i]).applyPressAction(); result = true; } } else { ((TwoStateObjectControl)t.Objects[i]).applyPressAction(); result = true; } } } } if (pars.ForceDoorSwitches || pars.ForceLightSwitches) { for (int i = 0; i < tales.GetLength(0); i++) { for (int j = 0; j < tales.GetLength(1); j++) { t = tales[i, j]; if (t.Objects != null) { for (int k = 0; k < t.Objects.Count; k++) { if (t.Objects[k] is DoorControl && pars.ForceDoorSwitches) { DoorControl dc = (DoorControl)t.Objects[k]; if (dc.IsOn() != pars.ForceDoorSwitchesState) { dc.applyPressAction(); } } else if (t.Objects[k] is LightsControl && pars.ForceLightSwitches) { LightsControl lc = (LightsControl)t.Objects[k]; if (lc.IsOn() != pars.ForceLightSwitchesState) { lc.applyPressAction(); } } } } } } } return(result); }