Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     spaceship = GetComponent<NetworkSpaceship>();
 }
Exemplo n.º 4
0
    public IEnumerator WaitForRespawn(NetworkSpaceship ship)
    {
        yield return(new WaitForSeconds(4.0f));

        ship.Respawn();
    }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     spaceship = GetComponent <NetworkSpaceship>();
 }
Exemplo n.º 6
0
    public IEnumerator WaitForRespawn(NetworkSpaceship ship)
    {
        yield return new WaitForSeconds(4.0f);

        ship.Respawn();
    }