Ejemplo n.º 1
0
        protected override void OnGamepadPluggedIn(SocketGamepad gamepad)
        {
            //Temporary until Acquire Caleb's menu system to select player


            if (PlayerSpawn.Count > 0)
            {
                //Debug.Log("Next Player: " + NextSpawn.ToString());
                if (NextSpawn < PlayerSpawn.Count)
                {
                    GameObject PlayerObj = PlayerSpawn[NextSpawn].Spawn(PlayerSpawn[NextSpawn].transform.position, PlayerSpawn[NextSpawn].transform.rotation);

                    SurvivorPlayer Player = PlayerObj.AddComponent <SurvivorPlayer>();
                    Player.Gamepad  = gamepad;
                    Player.FyoApp   = this;
                    Player.PlayerId = LocalPlayers.Count;

                    LocalPlayers.Add(Player);
                    ActiveGamepads.Add(gamepad, Player);

                    Framing.TrackedObjects.Add(Player.gameObject);
                }

                //Advance Spawn Point
                if (++NextSpawn >= PlayerSpawn.Count)
                {
                    NextSpawn = 0;
                }
            }
            else
            {
                Debug.LogError("Negative Spawn Index");
            }
        }
Ejemplo n.º 2
0
        protected override void OnGamepadUnplugged(SocketGamepad gamepad)
        {
            SurvivorPlayer Player = (SurvivorPlayer)ActiveGamepads[gamepad];

            Debug.Log("Removing Player " + Player.PlayerId + "(" + gamepad.SGID + ")");
            LocalPlayers.Remove(Player);
            Framing.TrackedObjects.Remove(Player.gameObject);
            ActiveGamepads.Remove(gamepad);

            Destroy(Player.gameObject);
        }
Ejemplo n.º 3
0
        IEnumerator PassIntoTheGreatBeyond()
        {
            yield return(new WaitForSeconds(2.5f));

            if (character.RespawnPool != null)
            {
                GameObject newMe = character.RespawnPool.Spawn(transform.position, transform.rotation, transform.localScale, false);

                SurvivorPlayer newSurvivor = newMe.AddComponent <SurvivorPlayer>();
                newSurvivor.PlayerId = PlayerId;
                newSurvivor.Gamepad  = Gamepad;

                FyoApp.ActiveGamepads[Gamepad] = newSurvivor;

                newMe.SetActive(true);
            }
            gameObject.SetActive(false);
            Destroy(this);
        }