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; }
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(); }
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); }
// 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; } }