Пример #1
0
 public void EndLevel()
 {
     if (currentLevel != NUM_LEVELS - 1)
     {
         sceneManagInstance.ChangeScene(SceneManagement.Scenes.MAP_GENERATION);
     }
     else
     {
         EndGame(true);
     }
 }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //Check to see if player has entered the door
     if (collision.tag == "Player")
     {
         sceneController.completionStatus = 1;
         sceneController.ChangeScene("GameOverScene");
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (!virtualKeyboard)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                keyDown = KeyCode.Space;
            }
            else if (Input.GetKeyDown(KeyCode.Escape))
            {
                keyDown = KeyCode.Escape;
            }
            else if (Input.GetKeyDown(KeyCode.Comma))
            {
                keyDown = KeyCode.Comma;
            }
            else if (Input.GetKeyDown(KeyCode.Period))
            {
                keyDown = KeyCode.Period;
            }
        }


        // Change the player's location with < and >
        if (keyDown.Equals(KeyCode.Comma))  // Move left with < key
        {
            playerLocation = (playerLocation - 1 + locations.Length) % locations.Length;
        }
        if (keyDown.Equals(KeyCode.Period))  // Move right with > key
        {
            playerLocation = (playerLocation + 1) % locations.Length;
        }
        if (keyDown.Equals(KeyCode.Space))
        {
            GlobalControls.globalControlsProperties.Remove("isStrategicMap");
            SceneManagement sceneManagement = GameObject.Find("Managers").GetComponent <ReferenceManager>().sceneManagement.GetComponent <SceneManagement>();
            sceneManagement.ChangeScene(locations[playerLocation].GetComponent <MapMarker>().mapName);
        }
        // Move the player on top of the marker for the location they are currently at
        player.transform.position = locations[playerLocation].transform.position + Vector3.up;

        keyDown = KeyCode.JoystickButton0;
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        SceneManagement smInstance = FindObjectOfType <SceneManagement>();

        smInstance.ChangeScene(SceneManagement.Scenes.MENU);
    }
Пример #5
0
 public void StartBtn()
 {
     sceneManagInstance.ChangeScene(SceneManagement.Scenes.MAP_GENERATION);
     soundManagInstance.PlaySound(SoundManager.SoundList.NEKO_NOISE);
     soundManagInstance.PlayMusic(SoundManager.MusicList.NONE);
 }
Пример #6
0
    void Update()
    {
        if (GlobalControls.globalControlsProperties.Contains("adminMode"))
        {
            if (!virtualKeyboard)
            {
                // Set keyDown to a specific cheat
                if (Input.GetKeyDown(preQuakeTeleport))
                {
                    keyDown = preQuakeTeleport;
                }
                else if (Input.GetKeyDown(quakeTeleport))
                {
                    keyDown = quakeTeleport;
                }
                else if (Input.GetKeyDown(strategicMapTeleport))
                {
                    keyDown = strategicMapTeleport;
                }
                else if (Input.GetKeyDown(completeWater))
                {
                    keyDown = completeWater;
                }
                else if (Input.GetKeyDown(completePoop))
                {
                    keyDown = completePoop;
                }
                else if (Input.GetKeyDown(restart))
                {
                    keyDown = restart;
                }
                else if (Input.GetKeyDown(loadPoopItems))
                {
                    keyDown = loadPoopItems;
                }
                else if (Input.GetKeyDown(loadWaterItems))
                {
                    keyDown = loadWaterItems;
                }
                else if (Input.GetKeyDown(loadPreQuakeItems))
                {
                    keyDown = loadPreQuakeItems;
                }
                else if (Input.GetKeyDown(changeCondition))
                {
                    keyDown = changeCondition;
                }
                else if (Input.GetKeyDown(angieItems))
                {
                    keyDown = angieItems;
                }
                else if (Input.GetKeyDown(carlosItems))
                {
                    keyDown = carlosItems;
                }
                else if (Input.GetKeyDown(demItems))
                {
                    keyDown = demItems;
                }
                else if (Input.GetKeyDown(annetteItems))
                {
                    keyDown = annetteItems;
                }
                else if (Input.GetKeyDown(safiItems))
                {
                    keyDown = safiItems;
                }
                else if (Input.GetKeyDown(rainerItems))
                {
                    keyDown = rainerItems;
                }
            }

            if (keyDown.Equals(preQuakeTeleport))//Load PreQuakeHouse
            {
                if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    sceneManagement.ChangeScene("PreQuakeApartment");
                }
                else
                {
                    sceneManagement.ChangeScene("PreQuakeHouse");
                }
            }
            if (keyDown.Equals(quakeTeleport))//Load QuakeHouse
            {
                if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    sceneManagement.ChangeScene("QuakeApartment");
                }
                else
                {
                    sceneManagement.ChangeScene("QuakeHouse");
                }
            }
            if (keyDown.Equals(strategicMapTeleport))//Load Strategic Map
            {
                sceneManagement.ChangeScene("StrategicMap");
            }
            if (meters && keyDown.Equals(completeWater)) //Complete Water
            {
                meters.MarkTaskAsDone("water");
            }
            if (meters && keyDown.Equals(completePoop)) //Complete Poop
            {
                meters.MarkTaskAsDone("poop");
            }
            if (keyDown.Equals(restart)) //Restart Game
            {
                sceneManagement.Restart();
            }
            if (keyDown.Equals(loadPoopItems)) //Load Yard with Latrine Items
            {
                if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    GlobalItemList.Reset();
                    GlobalItemList.UpdateItemList("Bucket", "Inventory", new Vector3(0, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Bucket 2", "Inventory", new Vector3(1, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Bag", "Inventory", new Vector3(2, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Toilet Paper", "Inventory", new Vector3(3, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Wood Chips", "Inventory", new Vector3(4, 0, 0), "Player");
                    sceneManagement.ChangeScene("Street");
                }
                else
                {
                    GlobalItemList.Reset();
                    GlobalItemList.UpdateItemList("Shovel", "Inventory", new Vector3(0, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Plywood", "Inventory", new Vector3(1, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Rope", "Inventory", new Vector3(2, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Tarp", "Inventory", new Vector3(3, 0, 0), "Player");
                    GlobalItemList.UpdateItemList("Toilet Paper", "Inventory", new Vector3(4, 0, 0), "Player");
                    sceneManagement.ChangeScene("Yard");
                }
            }
            if (keyDown.Equals(loadWaterItems)) //Load scene with water task items
            {
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Dirty Water Bottle", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Bleach", "Inventory", new Vector3(1, 0, 0), "Player");
                sceneManagement.ChangeScene(SceneManager.GetActiveScene().name);
            }
            if (keyDown.Equals(loadPreQuakeItems)) //Load Yard with PreQuake Items
            {
                if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    GlobalItemList.Reset();
                    GlobalItemList.UpdateItemList("Bleach", "Street", new Vector3(4.5f, 1.5f, -8.5f), "Go Bag 1");
                    GlobalItemList.UpdateItemList("Book", "Street", new Vector3(4.5f, 1.5f, -7.5f), "Go Bag 2");
                    sceneManagement.ChangeScene("Street");
                }
                else
                {
                    GlobalItemList.Reset();
                    GlobalItemList.UpdateItemList("Sunscreen", "Yard", new Vector3(6.5f, 0.5f, 0.5f), "");
                    GlobalItemList.UpdateItemList("Dirty Water Bottle", "Yard", new Vector3(-6.5f, 0.5f, 0.5f), "");
                    GlobalItemList.UpdateItemList("Flashlight", "Yard", new Vector3(3.5f, 0.5f, 3.5f), "");
                    GlobalItemList.UpdateItemList("Book", "Yard", new Vector3(-5.5f, 0.5f, -7.5f), "");
                    sceneManagement.ChangeScene("Yard");
                }
            }

            if (keyDown.Equals(changeCondition))
            {
                if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    Debug.Log("Changing Global Apartment condition flag from " +
                              GlobalControls.globalControlsProperties.Contains("apartmentCondition") +
                              " to " + !GlobalControls.globalControlsProperties.Contains("apartmentCondition"));
                    GlobalControls.globalControlsProperties.Remove("apartmentCondition");
                    GlobalItemList.Reset();
                }
                else if (!GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
                {
                    Debug.Log("Changing Global Apartment condition flag from " +
                              GlobalControls.globalControlsProperties.Contains("apartmentCondition") +
                              " to " + !GlobalControls.globalControlsProperties.Contains("apartmentCondition"));
                    GlobalControls.globalControlsProperties.Add("apartmentCondition");
                    GlobalItemList.Reset();
                }
            }

            if (keyDown.Equals(angieItems))
            {
                Debug.Log("Giving Angie Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("First Aid Kit", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Epi Pen", "Inventory", new Vector3(1, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("PSU");
            }
            else if (keyDown.Equals(carlosItems))
            {
                Debug.Log("Giving Carlos Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Radio", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Batteries", "Inventory", new Vector3(1, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("PSU");
            }
            else if (keyDown.Equals(demItems))
            {
                Debug.Log("Giving Dem Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Canned Food", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Can Opener", "Inventory", new Vector3(1, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("WaterfrontPark");
            }
            else if (keyDown.Equals(annetteItems))
            {
                Debug.Log("Giving Annette Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Dog Crate", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Leash", "Inventory", new Vector3(1, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("PioneerCourthouseSquare");
            }
            else if (keyDown.Equals(safiItems))
            {
                Debug.Log("Giving Safi Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Wrench", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("WaterfrontPark");
            }
            else if (keyDown.Equals(rainerItems))
            {
                Debug.Log("Giving Rainer Required Items");
                GlobalItemList.Reset();
                GlobalItemList.UpdateItemList("Tent", "Inventory", new Vector3(0, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Blanket", "Inventory", new Vector3(1, 0, 0), "Player");
                GlobalItemList.UpdateItemList("Water Bottle Clean", "Inventory", new Vector3(2, 0, 0), "Player");
                sceneManagement.ChangeScene("PioneerCourthouseSquare");
            }

            keyDown = KeyCode.JoystickButton0;
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (!isLevelSet)
        {
            return;
        }

        if (dcInstance == null)
        {
            dcInstance = FindObjectOfType <DemonCreator>();
        }

        if (Utility.IsOver(stepTimer) && numStep >= 0)
        {
            CellularStep();
            stepTimer = Utility.StartTimer(timeBetweenSteps);
        }

        if (Utility.IsOver(stepTimer) && numStep < 0 && zones.Count == 0)
        {
            CalculateEmptyZones();
            RemoveLittleZones();
            stepTimer = Utility.StartTimer(timeBetweenSteps);
        }

        if (Utility.IsOver(stepTimer) && numStep < 0 && zones.Count > 1)
        {
            JoinZones();

            numStep   = numStepAfterZone;
            stepTimer = Utility.StartTimer(timeBetweenSteps * 2);

            zones.Clear();
            CalculateEmptyZones();
        }

        if (Utility.IsOver(stepTimer) && zones.Count == 1 && numStep < 0 && !hasFinishedMap)
        {
            hasFinishedMap = true;
            numStep        = numStepFinish;
            stepTimer      = Utility.StartTimer(timeBetweenSteps);
        }

        if (Utility.IsOver(stepTimer) && zones.Count == 1 && numStep < 0 && hasFinishedMap && !isDone)
        {
            RemoveImperfections();

            SetPlace(ref entranceZone, ref entrancePlace, null);
            SetPlace(ref stairZone, ref stairPlace, stairPrefab);
            for (int i = 0; i < treasureZones.Length; i++)
            {
                GameObject obj   = SetPlace(ref treasureZones[i], ref treasurePlaces[i], treasurePrefab);
                int        index = Random.Range(0, objects.Length);
                obj.GetComponent <ObjBehavior>().SetObject(objects[index]);
            }
            SpawnDemons();

            SetSprites();
            isDone = true;

            Debug.Log("DONE");
            smInstance.ChangeScene(SceneManagement.Scenes.GAME);
        }
    }