Exemplo n.º 1
0
    public void HandleKeyUp(string key)
    {
        Player player;

        if (GGJGameManager.TryGetPlayer(key, out player))
        {
            player.ResetSize();
        }
    }
Exemplo n.º 2
0
    public void HandleKeyDown(string key)
    {
        Player player;

        if (GGJGameManager.TryGetPlayer(key, out player))
        {
            player.Jump();
        }
    }
Exemplo n.º 3
0
    public void HandleKeyHold(string key)
    {
        Player player;

        if (GGJGameManager.TryGetPlayer(key, out player))
        {
            player.Grow();
        }
    }
Exemplo n.º 4
0
 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;
         }
     }
 }
Exemplo n.º 5
0
    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);
        }
    }
Exemplo n.º 6
0
 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]);
     }
 }
Exemplo n.º 7
0
    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);
        }
    }
Exemplo n.º 8
0
    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();
    }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
 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);
         }
     }
 }
Exemplo n.º 11
0
 public void TestUI()
 {
     GGJGameManager.SetState("play");
 }
Exemplo n.º 12
0
 // 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);
 }
Exemplo n.º 14
0
 public void OnStateExit()
 {
     GGJGameManager.SetMusic(false);
 }
Exemplo n.º 15
0
    private PlayerManager m_GameWinner;         // Reference to the winner of the game.  Used to make an announcement of who won.

    void Awake()
    {
        s_Instance = this;
    }
Exemplo n.º 16
0
 public void Quit()
 {
     //Application.Quit();
     GGJGameManager.SetState("mainMenu");
 }