예제 #1
0
        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();
            }
        }
        public IEnumerator WaitForRespawn(NetworkSpaceship ship)
        {
            yield return(new WaitForSeconds(4.0f));

            ship.Respawn();
        }