Ejemplo n.º 1
0
    // 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);
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (!Application.isPlaying)
     {
         if (floorLocation != ElevatorGlobals.currentFloor)
         {
             floorLocation = ElevatorGlobals.currentFloor;
         }
         scenarioLocation = transform.position;
     }
 }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    // 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;
        }
    }
Ejemplo n.º 5
0
    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
        }
    }
Ejemplo n.º 6
0
    //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;
    }
Ejemplo n.º 7
0
    //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);
        }
    }
Ejemplo n.º 8
0
 GameObject GetReference(state.floor param)
 {
     return(floorDic[param].GetObjReference());
 }
Ejemplo n.º 9
0
 public void newParent(state.floor targetFloor)
 {
     transform.parent = fM.getReference(targetFloor).transform;
     return;
 }
Ejemplo n.º 10
0
 public GameObject getReference(state.floor param)
 {
     return(floorDic[param].reference);
 }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     playerObject  = GameObject.FindGameObjectWithTag("PlayerManager");
     playerFSM     = playerObject.GetComponent <PlayMakerFSM>();
     previousFloor = state.floor.Empty;
 }