Exemplo n.º 1
0
    private void FixedUpdate()
    {
        if (eating)
        {
            timer++;

            if (timer >= ticksPerPiece)
            {
                timer -= ticksPerPiece;

                completed--;

                pieces[completed].SetActive(false);

                if (completed == 0)
                {
                    RoomTower tower = GameObject.FindGameObjectWithTag("RoomStack").GetComponent <RoomTower>();
                    tower.GenerateLevel(0);

                    finished = false;
                    returned = true;
                    eating   = false;
                    timer    = 0;
                }
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (!returned)
        {
            returned = true;
            PortalManager.CloseAllDoors();

            RoomTower tower = GameObject.FindGameObjectWithTag("RoomStack").GetComponent <RoomTower>();

            if (!finished)
            {
                TextMessage.AddMessage((8 - completed) + " pieces left to collect, go back.");
                if (completed != 0)
                {
                    tower.GenerateLevel(completed);
                }
            }
            else
            {
                // Player won the game.
                PortalManager.MergeDoors(tower.GetStartRoomDoor(), tower.GetStartRoomDoor());
            }
        }
    }