public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>(); NetworkSpaceship spaceship = gamePlayer.GetComponent <NetworkSpaceship>(); spaceship.name = lobby.name; spaceship.color = lobby.playerColor; spaceship.score = 0; spaceship.lifeCount = 3; }
void OnCollisionEnter(Collision collision) { //we collide so we dirty the NetworkTrasnform to sync it on clients. _netTransform.SetDirtyBit(1); if (collision.gameObject.tag == "Fire") { NetworkSpaceshipBullet bullet = collision.gameObject.GetComponent <NetworkSpaceshipBullet>(); bullet.owner.score += level; Explode(); } else if (collision.gameObject.tag == "Player") {//we collided with the player, destroy it. NetworkSpaceship ship = collision.gameObject.GetComponent <NetworkSpaceship>(); ship.Kill(); Explode(); } }
// Use this for initialization void Start() { spaceship = GetComponent<NetworkSpaceship>(); }
public IEnumerator WaitForRespawn(NetworkSpaceship ship) { yield return(new WaitForSeconds(4.0f)); ship.Respawn(); }
// Use this for initialization void Start() { spaceship = GetComponent <NetworkSpaceship>(); }
public IEnumerator WaitForRespawn(NetworkSpaceship ship) { yield return new WaitForSeconds(4.0f); ship.Respawn(); }