예제 #1
0
    void Update()
    {
        if (State == GameModeState.PreGame)
        {
            //If the pregame time runs out start the gamemode
            if (RemainingTime <= 0f)
            {
                State = GameModeState.Gameplay;

                PrepareForStart();
                StartGameMode();

                if (EnablePickUps)
                {
                    Pm.Enable();
                }
            }

            //Designed for Local play. Checks if a player wants to join or drop out during pregame
            if (PhotonNetwork.offlineMode)
            {
                for (var i = 0; i < TribotInput.InputCount; i++)
                {
                    if (TribotInput.GetButtonDown(TribotInput.InputButtons.Start, i))
                    {
                        if (!Players.Any(x => !x.Ai && x.InputIndex == i))
                        {
                            var player = Players.First(x => x.Ai);
                            player.Ai         = false;
                            player.InputIndex = i;
                            player.CreatePlayer(PField.GetSpawnLocation(player.Index));
                        }
                    }

                    if (TribotInput.GetButtonDown(TribotInput.InputButtons.Back, i))
                    {
                        if (Players.Any(x => !x.Ai && x.InputIndex == i))
                        {
                            var player = Players.First(x => !x.Ai && x.InputIndex == i);
                            player.Ai = true;
                            player.CreatePlayer(PField.GetSpawnLocation(player.Index));
                        }
                    }
                }
            }
        }

        if (State == GameModeState.Gameplay)
        {
            ExtendedUpdate();
        }
    }
예제 #2
0
 void Update()
 {
     for (int i = 0; i < TribotInput.InputCount; i++)
     {
         if (TribotInput.GetButtonDown(TribotInput.InputButtons.A, i))
         {
             print("A pressed on pad " + TribotInput.IntToIndex(i).ToString());
         }
         if (TribotInput.GetButtonDown(TribotInput.InputButtons.RT, i))
         {
             print("RT pressed on pad " + TribotInput.IntToIndex(i).ToString());
         }
     }
 }
예제 #3
0
 void Update()
 {
     if (TribotInput.GetButtonDown(TribotInput.InputButtons.Start, -1))
     {
         if (isActive)
         {
             Close();
         }
         else
         {
             Open();
         }
     }
 }
예제 #4
0
    public override void UpdateState()
    {
        if (isPressedRT)
        {
            if (TribotInput.GetButtonUp(TribotInput.InputButtons.RT, -1))
            {
                isPressedRT = false;
            }
        }
        if (isPressedLT)
        {
            if (TribotInput.GetButtonUp(TribotInput.InputButtons.LT, -1))
            {
                isPressedLT = false;
            }
        }

        if (PhotonNetwork.inRoom)
        {
            if (TribotInput.GetButton(TribotInput.InputButtons.RT, -1) && !isPressedRT)
            {
                isPressedRT = true;
                photonView.RPC("Iterate", PhotonTargets.MasterClient, IterateType.Next, ModelSkin.Model,
                               (int)PhotonNetwork.player.CustomProperties["Index"]);
            }
            if (TribotInput.GetButtonDown(TribotInput.InputButtons.RB, -1))
            {
                photonView.RPC("Iterate", PhotonTargets.MasterClient, IterateType.Next, ModelSkin.Skin,
                               (int)PhotonNetwork.player.CustomProperties["Index"]);
            }

            if (TribotInput.GetButton(TribotInput.InputButtons.LT, -1) && !isPressedLT)
            {
                isPressedLT = true;
                photonView.RPC("Iterate", PhotonTargets.MasterClient, IterateType.Previous, ModelSkin.Model,
                               (int)PhotonNetwork.player.CustomProperties["Index"]);
            }
            if (TribotInput.GetButtonDown(TribotInput.InputButtons.LB, -1))
            {
                photonView.RPC("Iterate", PhotonTargets.MasterClient, IterateType.Previous, ModelSkin.Skin,
                               (int)PhotonNetwork.player.CustomProperties["Index"]);
            }
        }
    }
예제 #5
0
    void Update()
    {
        int index;

        if (PhotonNetwork.offlineMode)
        {
            index = InputIndex;
        }
        else if ((int)PhotonNetwork.player.CustomProperties["Index"] == _info.Index)
        {
            index = -1;
        }
        else
        {
            return;
        }

        if (_player.CurrentAbility)
        {
            if (TribotInput.GetButtonUp(_player.CurrentAbility.MappedButton, index))
            {
                _abilityHandler.ReleaseAbility(_player.CurrentAbility);
            }
        }

        if (_state.CanInteract)
        {
            foreach (var ability in _player.Abilities)
            {
                if (TribotInput.GetButtonDown(ability.Key, index))
                {
                    _abilityHandler.CastAbility(ability.Value);
                }
            }
        }
    }
예제 #6
0
    // Update is called once per frame
    public override void UpdateState()
    {
        base.UpdateState();

        for (var i = 0; i < 5; i++)
        {
            if (TribotInput.GetButtonDown(TribotInput.InputButtons.Start, i))
            {
                bool exists = false;
                foreach (var map in _players.Where(map => map != null && map.GamepadIndex == (TribotInput.Index)i + 1))
                {
                    exists = true;
                }

                if (!exists)
                {
                    for (int j = 0; j < _players.Count; j++)
                    {
                        if (_players[j] == null)
                        {
                            _players[j] = new PlayerMap()
                            {
                                GamepadIndex = (TribotInput.Index)i + 1
                            };
                            _characterSelect.EnableButton(j, false);
                            break;
                        }
                    }
                }
            }

            if (TribotInput.GetButtonDown(TribotInput.InputButtons.Back, i))
            {
                bool exists = false;
                foreach (var map in _players.Where(map => map != null && map.GamepadIndex == (TribotInput.Index)i + 1))
                {
                    exists = true;
                }

                if (exists)
                {
                    for (int j = 0; j < _players.Count; j++)
                    {
                        if (_players[j] != null)
                        {
                            _players[j] = null;
                            _characterSelect.DisableButton(j);
                            break;
                        }
                    }
                }
            }
        }

        for (var i = 0; i < _players.Count; i++)
        {
            if (_players[i] != null)
            {
                if (PlayerTexts[i])
                {
                    PlayerTexts[i].text = "Player " + (i + 1);
                }

                if (TribotInput.GetButtonDown(TribotInput.InputButtons.RT, _players[i].Index))
                {
                    Iterate(IterateType.Next, ModelSkin.Model,
                            i);
                }
                if (TribotInput.GetButtonDown(TribotInput.InputButtons.RB, _players[i].Index))
                {
                    Iterate(IterateType.Next, ModelSkin.Skin,
                            i);
                }

                if (TribotInput.GetButtonDown(TribotInput.InputButtons.LT, _players[i].Index))
                {
                    Iterate(IterateType.Previous, ModelSkin.Model,
                            i);
                }
                if (TribotInput.GetButtonDown(TribotInput.InputButtons.LB, _players[i].Index))
                {
                    Iterate(IterateType.Previous, ModelSkin.Skin, i);
                }
            }
        }
    }