Beispiel #1
0
        private void InitialisePlayerController(NetworkedPlayerController IPC)
        {
            this.PlayerController = IPC;

            PlayerController.setCurrentShipChoice(PlayerShipClassChoice);
            PlayerController.initialiseShipClassManager(SpaceshipClassManager);

            // Hook up spaceship spawn event
            PlayerController.LocalPlayerShipSpawned += localPlayerShipCreatedHandler;
            PlayerController.LocalPlayerShipSpawned += UIManager.OnLocalPlayerShipSpawned;
            // as this is the local player,
            // there is no need to check for existing ship spawns
            // (they would have been observed directly through the RPC in the IPC)
            PlayerController.LocalPlayerShipHealthChanged += UIManager.SetCurrentPlayerHealth;
        }
Beispiel #2
0
        public void OnPlayerJoin(NetworkedPlayerController playerController)
        {
            MyContract.RequireArgumentNotNull(playerController, "playerController");
            PlayerIdentifier NewPlayerId = PlayerIdentifier.CreateNew(playerController);

            playerController.ShipDestroyed
                += delegate(PlayerIdentifier hunter)
                {
                Scoreboard.OnKillEvent(hunter, NewPlayerId);
                };
            Scoreboard.ScoreUpdate += playerController.OnScoreUpdate;
            Scoreboard.PlayerRemoved
                += playerController.OnPlayerRemovedFromScoreboardPassthrough;
            Scoreboard.RegisterNewPlayer(NewPlayerId);
            //Debug.Log("Game State Manager: Checking if we have a spaceship class manager");
            MyContract.RequireFieldNotNull(SSClassManager, "Spaceship Class Manager");
            //Debug.Log("Game State Manager: Initialising given NPC with our SSCManager");
            playerController.initialiseShipClassManager(SSClassManager);
        }