Example #1
0
    public void CreatePoint()
    {
        if (LevelStateManager.canCreateTetherPoint())
        {
            //Debug.Log("Create tether point");
            //CreateTimeTetherIndicator(GameManager.GetPlayer().transform.position, LevelStateManager.curState + 1);
            LevelStateManager.createTetherPoint();

            GameManager.GetPlayerScript().setPlaceAnchorAnim();

            AudioLibrary.PlayTetherPlacementSound();
            // Timeline arrow
            SetArrowTarget(LevelStateManager.curState, false, true);

            if (LevelStateManager.curState < tetherUICreateParticles.Length && tetherUICreateParticles[LevelStateManager.curState] != null)
            {
                tetherUICreateParticles[LevelStateManager.curState].Play();
            }
        }
        else
        {
            if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.tetherError))
            {
                AudioLibrary.PlayTetherErrorSound();
            }
            Debug.Log("Can't create tether point right now");
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        // Time tether
        if (Input.GetKeyDown(createPointKey))
        {
            if (LevelStateManager.canCreateTetherPoint())
            {
                Debug.Log("Create tether point");
                LevelStateManager.createTetherPoint();
                CreateTimeTetherIndicator(new Vector3(LevelStateManager.curState, 0, 0));
            }
            else
            {
                Debug.Log("Can't create tether point right now");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha0))
        {
            if (LevelStateManager.canLoadTetherPoint(0) && LevelStateManager.loadTetherPoint(0))
            {
                Debug.Log("Successfully loaded state 0");
                RemoveTimeTetherIndicator(0);
            }
            else
            {
                Debug.Log("Could not load state 0");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (LevelStateManager.canLoadTetherPoint(1) && LevelStateManager.loadTetherPoint(1))
            {
                Debug.Log("Successfully loaded state 1");
                RemoveTimeTetherIndicator(1);
            }
            else
            {
                Debug.Log("Could not load state 1");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (LevelStateManager.canLoadTetherPoint(2) && LevelStateManager.loadTetherPoint(2))
            {
                Debug.Log("Successfully loaded state 2");
                RemoveTimeTetherIndicator(2);
            }
            else
            {
                Debug.Log("Could not load state 2");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            if (LevelStateManager.canLoadTetherPoint(3) && LevelStateManager.loadTetherPoint(3))
            {
                Debug.Log("Successfully loaded state 3");
                RemoveTimeTetherIndicator(3);
            }
            else
            {
                Debug.Log("Could not load state 3");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            if (LevelStateManager.canLoadTetherPoint(4) && LevelStateManager.loadTetherPoint(4))
            {
                Debug.Log("Successfully loaded state 4");
                RemoveTimeTetherIndicator(4);
            }
            else
            {
                Debug.Log("Could not load state 4");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            if (LevelStateManager.canLoadTetherPoint(5) && LevelStateManager.loadTetherPoint(5))
            {
                Debug.Log("Successfully loaded state 5");
                RemoveTimeTetherIndicator(5);
            }
            else
            {
                Debug.Log("Could not load state 5");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            if (LevelStateManager.canLoadTetherPoint(6) && LevelStateManager.loadTetherPoint(6))
            {
                Debug.Log("Successfully loaded state 6");
                RemoveTimeTetherIndicator(6);
            }
            else
            {
                Debug.Log("Could not load state 6");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            if (LevelStateManager.canLoadTetherPoint(7) && LevelStateManager.loadTetherPoint(7))
            {
                Debug.Log("Successfully loaded state 7");
                RemoveTimeTetherIndicator(7);
            }
            else
            {
                Debug.Log("Could not load state 7");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha8))
        {
            if (LevelStateManager.canLoadTetherPoint(8) && LevelStateManager.loadTetherPoint(8))
            {
                Debug.Log("Successfully loaded state 8");
                RemoveTimeTetherIndicator(8);
            }
            else
            {
                Debug.Log("Could not load state 8");
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha9))
        {
            if (LevelStateManager.canLoadTetherPoint(9) && LevelStateManager.loadTetherPoint(9))
            {
                Debug.Log("Successfully loaded state 9");
                RemoveTimeTetherIndicator(9);
            }
            else
            {
                Debug.Log("Could not load state 9");
            }
        }

        // Stasis Keys
        if (Input.GetKeyDown(createStasisKey) && LevelStateManager.canAddStasisBubble())
        {
            Vector3      spawnPos  = new Vector3(transform.position.x + Random.Range(-2.0f, 2.0f), transform.position.y + Random.Range(-2.0f, 2.0f), transform.position.z);
            StasisBubble newStasis = ((GameObject)Instantiate(stasisBubblePrefab, spawnPos, transform.rotation)).GetComponent <StasisBubble>();
            LevelStateManager.addStasisBubble(newStasis);
        }

        if (Input.GetKeyDown(removeStasisKey) && LevelStateManager.canRemoveStasisBubble())
        {
            LevelStateManager.removeLastStasisBubble();
        }

        // Sample tether UI
        if (pointText != null)
        {
            pointText.text = LevelStateManager.curState + " / " + (LevelStateManager.maxNumStates - 1);
        }

        // Sample stasis UI
        if (stasisText != null)
        {
            stasisText.text = LevelStateManager.numStasisLeft + " / " + LevelStateManager.maxNumStasis;
        }
    }