// Update is called once per frame void Update() { //Floor if (TeleportToFloor == state.floor.Empty) { TeleportToFloor = state.floor.Restaurant; } var eleManager = GameObject.FindGameObjectWithTag("ElevatorManager"); var eleGlobals = eleManager.GetComponent <ElevatorGlobals>(); ElevatorGlobals.currentFloor = TeleportToFloor; eleGlobals.doorOpen = true; OpenDoor = false; //Door Open if (OpenDoor == false && eleGlobals.doorOpen == true) { //We want to Close the Door // eleManager.GetComponent<ElevatorDoor>().OpenDoor(); } else if (OpenDoor == true && eleGlobals.doorOpen == false) { //We want to Open the Door // eleManager.GetComponent<ElevatorDoor>().CloseDoor(); } //Time of Day GameObject.FindGameObjectWithTag("HotelManager").GetComponent <timeOfDay>().setTime(ChangeTime); }
// Update is called once per frame void Update() { if (!Application.isPlaying) { if (floorLocation != ElevatorGlobals.currentFloor) { floorLocation = ElevatorGlobals.currentFloor; } scenarioLocation = transform.position; } }
void Awake() { if (floors.Length < 7) { return; } //Initialize the Dictionary floorDic = new Dictionary <state.floor, Floor>(); //Iterate through the state.floor enum to assign a Dict with every floor from the array string[] floorNames = System.Enum.GetNames(typeof(state.floor)); for (int i = 0; i < floorNames.Length; i++) { floorDic.Add((state.floor)i, new Floor(floors[i], floors[i].transform.position)); } activeFloor = state.floor.Empty; }
// Update is called once per frame void Update() { fM = GameObject.FindGameObjectWithTag("HotelManager").GetComponent <FloorManager>(); if (currentFloor != previousFloor) { if (Application.isEditor) { fM.loadNewFloor(currentFloor, false); } else { fM.loadNewFloor(currentFloor, true); } previousFloor = currentFloor; } }
public void loadNewExtras(state.floor target) { //Find all scenarios of our floor for Group A, and are correct for the time of day var Item = extraScenarios.FindAll(c => (c.GetComponent <ExtraScenario>().floorLocation == target) && (c.GetComponent <ExtraScenario>().floorGrouping == state.group.GroupA)); //If we have at least 1 scenario to spawn if (Item.Count > 0) { //Choose a random scenario toSpawn = Item[Random.Range(0, Item.Count)]; //Spawn the Scenario for Group A var a = Instantiate(toSpawn, toSpawn.GetComponent <ExtraScenario>().scenarioLocation, Quaternion.identity, extraHolder.transform); } else { //Spawn Nothing Currently } }
//Called from the lever to have the elevator move towards the targeted floor public void moveTowardsFloor(state.floor target) { floorPos = (int)ElevatorGlobals.currentFloor; if (floorPos < (int)target) { direction = 1; } else if (floorPos > (int)target) { direction = -1; } else { return; } globals.moving = true; accelerating = true; targetFloor = target; }
//Called from elevatorMovement when a new floor is reached //inEditor is true if this function is called inEditor, false otherwise void LoadNewFloor(state.floor targetFloor, bool inEditor) { if (activeFloor != targetFloor) { //Turn off the previously active floor foreach (Transform child in transform) { //child is your child transform child.gameObject.SetActive(false); } //Turn on the next floor floorDic[targetFloor].SetActiveStatus(true); //The New Active floor is the floor we just activated activeFloor = targetFloor; } if (!inEditor) { //Load in Extras, play sound effects etc. GetComponent <ExtraManager>().clearExtras(); GetComponent <ExtraManager>().loadNewExtras(targetFloor); } }
GameObject GetReference(state.floor param) { return(floorDic[param].GetObjReference()); }
public void newParent(state.floor targetFloor) { transform.parent = fM.getReference(targetFloor).transform; return; }
public GameObject getReference(state.floor param) { return(floorDic[param].reference); }
// Use this for initialization void Start() { playerObject = GameObject.FindGameObjectWithTag("PlayerManager"); playerFSM = playerObject.GetComponent <PlayMakerFSM>(); previousFloor = state.floor.Empty; }