//void OnTriggerExit(Collider other){ // foreach (GameObject target in targets) // target.SendMessage("Deactivate"); //} // Use this for initialization void Start() { localKeyVert = Random.Range(-1, 2); Debug.Log(localKeyVert); target = Controller.GetComponent <CreateFloor>(); Color random = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); if (target.key != 1) { GetComponent <Renderer>().material.color = random; } }
protected override void OnPersist(IEvent persistedEvent) { switch (persistedEvent) { case ConstructedHostel hostel: { var construct = hostel.Construction; foreach (var floor in construct.Floors) { if (Context.Child(floor.Tag).IsNobody()) { floor.HostelId = hostel.Construction.Detail.HostelId; var createFloor = new CreateFloor(floor); Self.Tell(createFloor); Context.System.Log.Info($"FloorActor", $"Creating Floor - {floor.Tag}"); } } if (Context.Child(construct.SepticTank.Tag).IsNobody()) { var septicSpec = construct.SepticTank; septicSpec.HostelId = hostel.Construction.Detail.HostelId; var septic = new CreateSepticTank(septicSpec); Self.Tell(septic); } if (Context.Child(construct.Reservoir.Tag).IsNobody()) { var waterSpec = construct.Reservoir; waterSpec.HostelId = hostel.Construction.Detail.HostelId;; var water = new CreateWaterReservoir(waterSpec); Self.Tell(water); } } break; case CreatedFloor createdFloor: { var floor = createdFloor.Floor; floor.HostelId = State.ConstructionRecord.Detail.HostelId; var floorState = new FloorState(floor); var floorActor = Context.ActorOf(FloorActor.Prop(new FloorHandler(), floorState, floor.Tag, _connectionString), floor.Tag); floorActor.Tell(new LayoutFloor()); } break; case CreatedSepticTank createdSepticTank: { var septic = createdSepticTank.SepticTankSpec; septic.HostelId = State.ConstructionRecord.Detail.HostelId; var septicState = new SepticTankState(septic.SepticTankId, septic.Height, septic.AlertHeight, septic.Sensors); var septicActor = Context.ActorOf(SepticTankActor.Prop(new SepticTankHandler(), septicState, septic.Tag, _connectionString), septic.Tag); septicActor.Tell(new InstallSensor()); } break; case CreatedWaterReservoir createdWater: { var water = createdWater.ReservoirSpec; water.HostelId = State.ConstructionRecord.Detail.HostelId; var reservoirState = new WaterReservoirState(water.ReservoirId, water.Height, water.AlertHeight, water.Sensors); var waterActor = Context.ActorOf(WaterReservoirActor.Prop(new WaterReservoirHandler(), reservoirState, water.Tag, _connectionString), water.Tag); waterActor.Tell(new InstallSensor()); } break; } base.OnPersist(persistedEvent); }