void Start()
    {
        if (_Player == this)
        {
            print("Player Start");
        }
        name = "Player " + ownerName + " " + viewId;

        playerNameTxt.transform.parent     = null;
        playerNameTxt.gameObject.hideFlags = HideFlags.HideInHierarchy;
        playerNameTxt.enabled = false;
        //LoadCar(carId);
        nitroAudio = InitSound(res.nitro, false);
        transform2 = gameObject.transform;
        if (bot2 && !online)
        {
            weapons.gameObject.SetActive(false);
        }
        AmplifyMotionEffect.RegisterRecursivelyS(gameObject);

#if !UNITY_WP8 && VOICECHAT
        voiceChatPlayer = GetComponent <VoiceChatPlayer>();
#endif
        //if (bot)
        //    StartCoroutine(StartBot3());
        owner.varParse.UpdateValues();
    }
Exemplo n.º 2
0
    void LoadCar()
    {
        if (m_Car)
        {
            _Pool.Save(m_Car.gameObject);
        }
        string path     = cop ? "police" : owner.carSet.carName;
        Spawn  spawnPos = GetSpawnStartPos();

        m_Car = _Pool.Load2(Resources.Load(path), spawnPos.pos, spawnPos.rot).GetComponent <CarControl>();
        if (m_Car.m_CarDamage.meshTest)
        {
            m_Car.m_CarDamage.meshTest.Reset(this == _Player);
            m_Car.rigidbody.velocity = m_Car.rigidbody.angularVelocity = Vector3.zero;
        }

        //m_Car = ((GameObject)Instantiate(Resources.Load(path), spawnPos.pos, spawnPos.rot)).GetComponent<CarControl>();
        m_Car.name   = "Player Car " + pv.playerName;
        transformCar = m_Car.tr;
        rigidbody    = m_Car.rigidbody;
        rigidbody.solverIterationCount = 6;
        m_CarSettings           = m_Car.GetComponent <CarSettings>() as CarSettings;
        m_CarSound              = m_Car.GetComponent <CarSound>() as CarSound;
        m_CarSettings.bypassABS = false;
        m_Car.pl = this;
        OnQualityChanged();
        var priority = this == _Player ? 100 : 130;

        foreach (var a in GetComponents <AudioSource>())
        {
            a.priority = priority;
        }
        foreach (var a in m_Car.audioSources)
        {
            a.priority = priority;
        }

        if (IsMine && !bot2)
        {
            _Game.MainCamera.Target = m_Car.tr;
        }
        AmplifyMotionEffect.RegisterRecursivelyS(m_Car.gameObject);
    }