Exemplo n.º 1
0
    IEnumerator RemoveTetherProcess(int tetherIndex)
    {
        if (false)
        {
            yield return(new WaitForSeconds(1));
        }

        // Remove the time tether indicator gameObject
        RemoveTimeTetherIndicator(tetherIndex, false);

        // Update the internal level state data in LevelStateManager
        //LevelStateManager.removeTetherPointAt(tetherIndex);
        if (LevelStateManager.removeTetherPointAt(tetherIndex))
        {
            Debug.Log("Removal succesful for point " + tetherIndex);
        }
        else
        {
            Debug.Log("Could not remove point " + tetherIndex);
        }

        // Update the screenshots
        ScreenshotManager.removeScreenshotAt(tetherIndex);

        // Set a new target for the timeline arrow
        SetArrowTarget(LevelStateManager.curState, true, false);
    }
Exemplo n.º 2
0
    private void doHit()
    {
        StasisBubble newStasis = Instantiate <GameObject>(stasisBubblePref, transform.position, transform.rotation).GetComponent <StasisBubble>();

        LevelStateManager.addStasisBubble(newStasis);
        cleanUp(true);
    }
Exemplo n.º 3
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");
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Tell the LevelStateMangager to remove this bubble
 /// </summary>
 public void RemoveBubble()
 {
     if (!LevelStateManager.removeStasisBubble(this))
     {
         DestroyBubble();
     }
 }
Exemplo n.º 5
0
    public void doNullify()
    {
        RaycastHit2D[] hits = Physics2D.CircleCastAll(transform.position, nullFieldRadius, Vector2.zero, 0f, nullLayers);
        for (int i = 0; i < hits.Length; i++)
        {
            RaycastHit2D losCheck;
            losCheck = Physics2D.Raycast(
                transform.position,
                hits[i].collider.transform.position - transform.position,
                Vector2.Distance(transform.position, hits[i].collider.transform.position),
                nullObstLayers.value);
            if (losCheck.collider != null)
            {
                continue;
            }

            Entity e = hits [i].collider.GetComponent <Entity> ();
            if (e != null && e.getFaction() == Entity.Faction.player)
            {
                e.addStatus(Status.get("Nullified", 0.1f));
            }

            StasisBubble sb = hits [i].collider.GetComponent <StasisBubble> ();
            if (sb != null)
            {
                LevelStateManager.removeStasisBubble(sb);
            }
        }
    }
Exemplo n.º 6
0
    void UpdateGameplayCursor()
    {
        // Choose sprite for main cursor (stasis)

        // If hovering over a stasis bubble
        if (LevelStateManager.CursorIsOverAStasisBubble() || TetherManager.CursorIsOverATetherPoint())
        {
            mainCursorRend.sprite = cursorStasisHover;
        }
        // TODO: This might be the wrong check. Might need to check where the player checks if can shoot a stasis bubble
        else if (GameManager.inst.canUseStasis && LevelStateManager.canAddStasisBubble())
        {
            mainCursorRend.sprite = cursorStasisEnabled;
        }

        else
        {
            mainCursorRend.sprite = cursorStasisDisabled;
        }

        // Secondary cursor (dash target)
        // Temporary: hide the dash cursor while zoomed out
        // TODO: replace this with a separate CursorState for zoom out
        if (GameManager.CameraIsZoomedOut() || !GameManager.inst.canUseDash)
        {
            dashCursorRend.enabled = false;
        }
        else
        {
            dashCursorRend.enabled = true;
        }

        if (GameManager.isPlayerDashing() == true)
        {
            dashTargetLock        = true;
            dashTargetLockPos     = dashCursor.transform.position;
            dashCursorRend.sprite = cursorDashTarget;
        }
        else
        {
            dashTargetLock = false;

            if (GameManager.dashIsCharged())
            {
                dashCursorRend.sprite = cursorDashEnabled;
            }
            else
            {
                dashCursorRend.sprite = cursorDashDisabled;
            }
        }

        // Update texture
        //dashCursorRend.texture = cursorDashEnabled;
    }
Exemplo n.º 7
0
 private void SetupSingleton()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance     = this;
         IsInitialised = true;
     }
 }
Exemplo n.º 8
0
    public override void perform(Controller c)
    {
        Player p = State.cast <Player> (c);

        Vector3 mousePos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));

        //bool inSBBounds = LevelStateManager.StasisBubbleAtPos (mousePos);

        // Use Stasis Placement ablility
        if (PlayerControlManager.GetKeyDown(ControlInput.FIRE_STASIS))
        {
            if (GameManager.inst.canUseStasis &&
                //!inSBBounds &&
                //!TetherManager.CursorIsOverATetherPoint () &&
                CursorManager.CursorInGameplayState())
            {
                p.setStasisShootAnim();
                c.getSelf().getAbility(0).use(c.getSelf(), mousePos);
            }

            if (!LevelStateManager.canAddStasisBubble() && !GlobalAudio.ClipIsPlaying(AudioLibrary.inst.stasisError))
            {
                AudioLibrary.PlayStasisErrorSound();
            }
        }

        // Use Dash ability
        if (PlayerControlManager.GetKeyDown(ControlInput.DASH))
        {
            if (GameManager.inst.canUseDash && CursorManager.CursorInGameplayState())
            {
                if (c.getSelf().getAbility(1).isReady())
                {
                    AudioLibrary.PlayDashForwardSound();
                }
                else
                {
                    if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.dashError))
                    {
                        AudioLibrary.PlayDashErrorSound();
                    }
                }///
                c.getSelf().getAbility(1).use(c.getSelf(), p.getJumpTargetPos());
            }
        }

        p.move();
        p.findTarget();
    }
Exemplo n.º 9
0
    private static bool placeStasisBubble(Entity e, Vector2 tarPos)
    {
        if (!LevelStateManager.canAddStasisBubble())
        {
            return(false);
        }

        float      angle = Vector2.Angle(Vector2.up, tarPos - (Vector2)e.transform.position);
        float      sign  = e.transform.position.x < tarPos.x ? -1f : 1f;
        Quaternion rot   = Quaternion.Euler(0f, 0f, angle * sign);

        StasisBullet s = StasisBullet.create(e.transform.position, rot, tarPos);

        Physics2D.IgnoreCollision(s.GetComponent <Collider2D> (), e.GetComponent <Collider2D> ());

        return(true);
    }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        if (LevelStateManager.canLoadTetherPoint(state))
        {
            button.interactable = true;
            //image.sprite = activeSprite;

            if (removeButton != null && !hideRemoveButton)
            {
                removeButton.gameObject.SetActive(true);
            }
        }
        else
        {
            button.interactable = false;
            //image.sprite = inactiveSprite;

            if (removeButton != null)
            {
                removeButton.gameObject.SetActive(false);
            }
        }

        // Pulse effect
        if (usePulseEffect)
        {
            pulse_theta += Time.deltaTime * pulse_scrollSpeed;
            if (pulse_theta > Mathf.PI * 2)
            {
                pulse_theta -= Mathf.PI * 2;
            }
            else if (pulse_theta < -Mathf.PI * 2)
            {
                pulse_theta += Mathf.PI * 2;
            }
        }

        if (usePulseEffect && button.interactable && !beingRemoved)
        {
            pulse_amount = ((Mathf.Sin(pulse_theta) / 2) + 0.5f) * pulse_intensity;
            //transform.localScale = new Vector3 (1 - pulse_amount, 1 - pulse_amount, 1 - pulse_amount);
            transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(1 - pulse_amount, 1 - pulse_amount, 1 - pulse_amount), 20 * Time.deltaTime);
        }
        else
        {
            transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(1, 1, 1), 20 * Time.deltaTime);
        }

        if (dynamicSpriteLight != null && !beingRemoved)
        {
            dynamicSpriteLight.gameObject.transform.localScale = transform.localScale;
            dynamicSpriteLight.isActive = button.interactable;

            if (hover)
            {
                dynamicSpriteLight.flicker_enabled = false;
                dynamicSpriteLight.pulse_enabled   = true;
            }
            else
            {
                dynamicSpriteLight.flicker_enabled = true;
                dynamicSpriteLight.pulse_enabled   = false;
            }
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// Called via UI buttons in the timeline to load a state
    /// </summary>
    /// <param name="state">State, as determined in the button</param>

    /*
     *  public void LoadPoint(int state)
     *  {
     *          RemoveTimeTetherIndicator(state + 1);
     *          LevelStateManager.loadTetherPoint(state);
     *
     *          // Temporary fix!!!
     *          GameManager.setPause(false);
     *  }
     */

    void LoadTetherPoint(int state)
    {
        RemoveTimeTetherIndicator(state + 1, true);
        LevelStateManager.loadTetherPoint(state);
    }
Exemplo n.º 12
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;
        }
    }