Esempio n. 1
0
    void StartDirectives()
    {
        mazeGoal = Instantiate(mazeGoalPrefab, MazeGenerator.instance.mazeGoalPosition, Quaternion.identity) as MazeGoal;
        mazeGoal.transform.SetParent(transform);

        var mazeKeyPositions = MazeGenerator.instance.GetRandomFloorPositions(keysToFind);

        for (int i = 0; i < mazeKeyPositions.Count; i++)
        {
            MazeKey mazeKey = Instantiate(mazeKeyPrefab, mazeKeyPositions[i], Quaternion.identity) as MazeKey;
            mazeKey.transform.SetParent(transform);
        }

        var slowMudPositions = MazeGenerator.instance.GetRandomFloorPositions(numSlowSpots);

        for (int i = 0; i < slowMudPositions.Count; i++)
        {
            SlowMud slowMud = Instantiate(slowMudPrefab, slowMudPositions[i], Quaternion.identity) as SlowMud;
            slowMud.transform.SetParent(transform);
        }

        var fastIcePositions = MazeGenerator.instance.GetRandomFloorPositions(numFastSpots);

        for (int i = 0; i < fastIcePositions.Count; i++)
        {
            FastIce fastIce = Instantiate(fastIcePrefab, fastIcePositions[i], Quaternion.identity) as FastIce;
            fastIce.transform.SetParent(transform);
        }
    }
Esempio n. 2
0
    void StartDirectives()
    {
        mazeGoal = Instantiate(mazeGoalPrefab, MazeGenerator.instance.mazeGoalPosition, Quaternion.identity) as MazeGoal;
        mazeGoal.transform.SetParent(transform);

        mazeKeyPositions = MazeGenerator.instance.GetRandomFloorPositions(keysToFind);

        for (int i = 0; i < mazeKeyPositions.Count; i++)
        {
            MazeKey mazeKey = Instantiate(mazeKeyPrefab, mazeKeyPositions[i], Quaternion.identity) as MazeKey;
            mazeKey.transform.SetParent(transform);
        }
    }
Esempio n. 3
0
    void StartDirectives()
    {
        mazeGoal = Instantiate(mazeGoalPrefab, MazeGenerator.instance.mazeGoalPosition, Quaternion.identity) as MazeGoal;
        mazeGoal.transform.SetParent(transform);

        mazeKeyPositions = MazeGenerator.instance.GetRandomFloorPositions(keysToFind);

        powerUpStarPositions   = MazeGenerator.instance.GetRandomFloorPositions(powerUpStarAvailable);
        powerUpSpeedPositions  = MazeGenerator.instance.GetRandomFloorPositions(powerUpSpeedAvailable);
        powerUpInvulnPositions = MazeGenerator.instance.GetRandomFloorPositions(powerUpInvulnAvailable);

        for (int i = 0; i < mazeKeyPositions.Count; i++)
        {
            MazeKey mazeKey = Instantiate(mazeKeyPrefab, mazeKeyPositions[i], Quaternion.identity) as MazeKey;
            mazeKey.transform.SetParent(transform);

            PowerUpStar powerUpStar = Instantiate(powerUpStarPrefab, powerUpStarPositions[i], Quaternion.identity) as PowerUpStar;
            powerUpStar.transform.SetParent(transform);

            PowerUpSpeed powerUpSpeed = Instantiate(powerUpSpeedPrefab, powerUpSpeedPositions[i], Quaternion.identity) as PowerUpSpeed;
            powerUpSpeed.transform.SetParent(transform);

            PowerUpInvuln powerUpInvuln = Instantiate(powerUpInvulnPrefab, powerUpInvulnPositions[i], Quaternion.identity) as PowerUpInvuln;
            powerUpInvuln.transform.SetParent(transform);
        }

        for (int i = 0; i < powerUpStarPositions.Count; i++)
        {
            PowerUpStar powerUpStar = Instantiate(powerUpStarPrefab, powerUpStarPositions[i], Quaternion.identity) as PowerUpStar;
            powerUpStar.transform.SetParent(transform);
        }
        for (int i = 0; i < powerUpSpeedPositions.Count; i++)
        {
            PowerUpSpeed powerUpSpeed = Instantiate(powerUpSpeedPrefab, powerUpSpeedPositions[i], Quaternion.identity) as PowerUpSpeed;
            powerUpSpeed.transform.SetParent(transform);
        }
        for (int i = 0; i < powerUpInvulnPositions.Count; i++)
        {
            PowerUpInvuln powerUpInvuln = Instantiate(powerUpInvulnPrefab, powerUpInvulnPositions[i], Quaternion.identity) as PowerUpInvuln;
            powerUpInvuln.transform.SetParent(transform);
        }
    }
Esempio n. 4
0
    public void SetupLevel(MazeLevel levelData)
    {
        objectRevealTimer.Clear();
        objectRevealTimer.AddObjectList(new SerialObjectTaskTimer.ObjectTaskList(blocksInitialRevealDelay));
        objectRevealTimer.AddObjectList(new SerialObjectTaskTimer.ObjectTaskList(camRevealDelay));
        objectRevealTimer.AddObjectList(new SerialObjectTaskTimer.ObjectTaskList(panelRevealDelay));

        if (UDLRCameraController.Instance != null)
        {
            CamAnimator[] animators = UDLRCameraController.Instance.GetCameraAnimators();
            CameraPanel.DisplayPosition[] camRevealOrder = { CameraPanel.DisplayPosition.TopLeft,     CameraPanel.DisplayPosition.TopRight,
                                                             CameraPanel.DisplayPosition.BottomRight, CameraPanel.DisplayPosition.BottomLeft };
            for (int i = 0; i < camRevealOrder.Length; ++i)
            {
                if (LevelController.Instance.LevelCollection.levels[LevelController.Instance.levelIndex].cameraToggles[(int)camRevealOrder[i]])
                {
                    foreach (CamAnimator camAnim in animators)
                    {
                        if (camAnim != null && camAnim.CameraPanel.camPosition == camRevealOrder[i])
                        {
                            HideObjectAndAddToRevealList(camAnim.gameObject, (int)VisibilityState.RevealingCameras);
                            break;
                        }
                    }
                }
            }
        }
        foreach (RotatorTriggerData rotator in levelData.rotators)
        {
            GameObject           rotatorTriggerObj = Instantiate(rotatorCubePrefab, rotator.position, Quaternion.identity);
            CameraRotatorTrigger rotatorTrigger    = rotatorTriggerObj.GetComponent <CameraRotatorTrigger>();
            if (rotatorTrigger != null)
            {
                rotatorTrigger.arcType = rotator.arcType;
            }
            HideObjectAndAddToRevealList(rotatorTriggerObj, (int)VisibilityState.RevealingObjects);
        }
        if (InputHandler.Instance != null)
        {
            for (int panelPos = 0; panelPos < (int)CameraPanel.DisplayPosition.NumPositions; ++panelPos)
            {
                if (LevelController.Instance.LevelCollection.levels[LevelController.Instance.levelIndex].cameraToggles[panelPos])
                {
                    GameObject     cube           = Instantiate(playerCubePrefab, levelData.cubeStartPositions[panelPos], Quaternion.identity);
                    CubeController cubeController = cube.GetComponent <CubeController>();
                    Assert.IsNotNull(cubeController);
                    InputHandler.Instance.SetCubeController(panelPos, cubeController);
                    cubeController.associatedPanelPosition = (CameraPanel.DisplayPosition)panelPos;
                    cube.layer = LayerMask.NameToLayer(CameraPanel.PositionLayerNames[panelPos]);
                    HideObjectAndAddToRevealList(cube, (int)VisibilityState.RevealingObjects);
                    GameObject goal           = Instantiate(goalCubePrefab, levelData.goalPositions[panelPos], Quaternion.identity);
                    MazeGoal   goalController = goal.GetComponent <MazeGoal>();
                    Assert.IsNotNull(goalController);
                    goal.layer = LayerMask.NameToLayer(CameraPanel.PositionLayerNames[panelPos]);
                    HideObjectAndAddToRevealList(goal, (int)VisibilityState.RevealingObjects);
                    goalController.associatedDisplayPosition = (CameraPanel.DisplayPosition)panelPos;
                    if (UDLRCameraController.Instance != null)
                    {
                        MeshRenderer meshRenderer = cube.GetComponent <MeshRenderer>();
                        if (meshRenderer != null)
                        {
                            meshRenderer.material.SetColor("_EmissionColor", UDLRCameraController.Instance.GetCameraAnimators()[panelPos].GetCamObjColour());
                        }
                        MeshRenderer goalMeshRenderer = goal.GetComponent <MeshRenderer>();
                        if (goalMeshRenderer != null)
                        {
                            goalMeshRenderer.material.SetColor("_EmissionColor", UDLRCameraController.Instance.GetCameraAnimators()[panelPos].GetCamObjColour());
                        }
                    }
                }
            }
        }
        if (UDLRCameraController.Instance != null)
        {
            UDLRCameraController.Instance.panelController.enabled = false;
            objectRevealTimer.AddObjectToObjectsList(UDLRCameraController.Instance.gameObject, (int)VisibilityState.RevealingPanel);
        }
        objectRevealTimer.BeginObjectTasks();
    }
Esempio n. 5
0
 public void CreateMazeGoal()
 {
     mazeGoal = Instantiate(mazeGoalPrefab, MazeGenerator.instance.mazeGoalPosition, Quaternion.identity) as MazeGoal;
     mazeGoal.transform.SetParent(transform);
 }
Esempio n. 6
0
 void StartDirectives()
 {
     mazeGoal = Instantiate(mazeGoalPrefab, MazeGenerator.instance.mazeGoalPosition, Quaternion.identity) as MazeGoal;
     mazeGoal.transform.SetParent(transform);
     GameObject.Find("MazeGoal").GetComponent <Collider2D>().enabled = true;
 }
Esempio n. 7
0
 void Start()
 {
     KeyValueText   = GameObject.Find("KeyValueText").GetComponent <Text>();
     mazeGoalPrefab = GameObject.Find("MazeGoal").GetComponent <MazeGoal>();
     GameObject.Find("MazeGoal").GetComponent <Collider2D>().enabled = false;
 }