public void HandleKeyUp(string key) { Player player; if (GGJGameManager.TryGetPlayer(key, out player)) { player.ResetSize(); } }
public void HandleKeyDown(string key) { Player player; if (GGJGameManager.TryGetPlayer(key, out player)) { player.Jump(); } }
public void HandleKeyHold(string key) { Player player; if (GGJGameManager.TryGetPlayer(key, out player)) { player.Grow(); } }
private void FixedUpdate() { Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position + new Vector3(0f, 0.5f, 0f), PLAYER_RADIUS, _obstacleLayer); for (int i = 0; i < colliders.Length; i++) { if (colliders[i].gameObject != gameObject) { GGJGameManager.KillPlayer(this); return; } } }
public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { if (lobbyPlayer == null) { return; } Prototype.NetworkLobby.LobbyPlayer lp = lobbyPlayer.GetComponent <Prototype.NetworkLobby.LobbyPlayer>(); if (lp != null) { GGJGameManager.AddTank(gamePlayer, lp.slot, lp.playerColor, lp.nameInput.text, lp.playerControllerId); } }
void Update() { for (int i = 0; i < _inputs.Length; i++) { GGJGameManager.HandleKeyDown(_inputs[i]); } if (Input.GetKey(_inputs[i])) { GGJGameManager.HandleKeyHold(_inputs[i]); } if (Input.GetKeyUp(_inputs[i])) { GGJGameManager.HandleKeyUp(_inputs[i]); } }
public void Grow() { float deltaTime = Time.deltaTime; _growOffset += Time.deltaTime; if (_growOffset > 1f) { GGJGameManager.KillPlayer(this); return; } else if (_growOffset > 0.3) { float offset = _growOffset - 0.3f; _graphicTransform.localPosition = new Vector3(Mathf.Sin(offset * 100) * offset, _graphicTransform.localPosition.y, 0f); _graphicTransform.localScale = new Vector3(1f + offset, 1f + offset); } }
void Awake() { DontDestroyOnLoad(this.gameObject); Assert.IsNull(_instance); _instance = this; _curGameState = new MainMenuState(); _players = new Dictionary <string, Player>(); _gameStates = new Dictionary <string, IGameState>() { { "mainMenu", _curGameState }, { "joinGame", new JoinGameState() }, { "play", new PlayState() }, { "gameOver", new GameOverState() } }; _inputManager = GetComponent <GGJInputManager>(); _inputManager.Setup(); _audioManager = GetComponent <GGJAudioManager>(); _audioManager.Setup(); _curGameState.OnStateEnter(); }
public void OnStateEnter() { // var scoreLayouts = GameObject.FindGameObjectsWithTag("Score"); // List<string> names = GGJGameManager.GetPlayerNames(); // int j = 0; // for (int i = 0; i < names.Count; i++) // { // if (scoreLayouts[j].transform.childCount > 9) { j++; } // _textPrefab = Object.Instantiate(TextPrefab); // Player player; // GGJGameManager.TryGetPlayer(names[i], out player); // _textPrefab.GetComponent<Text>().text = names[i].ToUpper() + ": " + player.score; // _textPrefab.transform.SetParent(scoreLayouts[j].transform, false); // } _level = (Object.Instantiate(_levelPrefab) as GameObject).transform; _level.position = Vector3.zero; GGJGameManager.SetMusic(true); }
public void HandleKeyDown(string key) { if (key.Equals("space")) { GGJGameManager.SetState("play"); } else { Player player; if (GGJGameManager.TryGetPlayer(key, out player)) { player.ResetSize(); player.Jump(); } else { GameObject playerGO = GameObject.Instantiate(_playerPrefab); player = playerGO.GetComponent <Player>(); player.Setup(key); GGJGameManager.AddPlayer(key, player); } } }
public void TestUI() { GGJGameManager.SetState("play"); }
// Start is called before the first frame update void Start() { GGJGameManager.SetState("joinGame"); }
// Start is called before the first frame update void Start() { _targetGroup = GetComponent <CinemachineTargetGroup>(); GGJGameManager.RegisterCameraGroup(this); }
public void OnStateExit() { GGJGameManager.SetMusic(false); }
private PlayerManager m_GameWinner; // Reference to the winner of the game. Used to make an announcement of who won. void Awake() { s_Instance = this; }
public void Quit() { //Application.Quit(); GGJGameManager.SetState("mainMenu"); }