void Awake()
    {
        player = Vox.LoadModel("Assets/models/player_stand.vox", "object");
        player.obj.transform.position = new Vector3(150, 11, 150);
        player.obj.name = "Player";

        GameObject lightGameObject = new GameObject("LightAbovePlayer");

        pLight            = lightGameObject.AddComponent <Light>();
        pLight.type       = LightType.Point;
        pLight.color      = Color.grey;
        pLight.range      = 200;
        pLight.intensity  = 1.0f;
        pLight.renderMode = LightRenderMode.ForceVertex;

        GameObject lightGameObject2 = new GameObject("LightBelowPlayer");

        pUnder            = lightGameObject2.AddComponent <Light>();
        pUnder.type       = LightType.Point;
        pUnder.color      = Color.white;
        pUnder.range      = 200;
        pUnder.intensity  = 3.4f;
        pUnder.renderMode = LightRenderMode.ForceVertex;

        //player.obj.AddComponent<MeshCollider> ();
        player.obj.AddComponent <Rigidbody> ();
        player.obj.GetComponent <MeshCollider> ().convex      = true;
        player.obj.GetComponent <Rigidbody> ().sleepThreshold = 1.0f;
        player.obj.GetComponent <Rigidbody> ().mass           = 10;
        player.obj.GetComponent <Rigidbody> ().isKinematic    = true;
        player.obj.GetComponent <Rigidbody> ().angularDrag    = 0.09f;

        // Add player as target for the smoothfollow camera script.
        //SmoothFollow sf = Camera.main.GetComponent<SmoothFollow> ();
        //SmoothCamera sf = Camera.main.GetComponent<SmoothCamera>();
        SmoothFollow script = Camera.main.GetComponent <SmoothFollow>();

        script.target = player.obj.transform;
        //sf.target = player.obj.transform;
        //GameObject.Find("Camera").GetComponent("SmoothFollow").target = player.obj.transform;

//        playerJet1 = (GameObject)Instantiate(jet, player.obj.transform.position, Quaternion.identity);
//        playerJet1.transform.parent = player.obj.transform;
//        playerJet1.transform.localRotation = Quaternion.Euler (new Vector3(90, 0, 0));
//        playerJet1.transform.localPosition = new Vector3 (0.5f, 1.89f, -0.7f);
//        playerJet1.GetComponent<ParticleSystem> ().loop = false;
//        playerJet1.GetComponent<ParticleSystem> ().startSize = 5;
//        playerJet1.GetComponent<ParticleSystem> ().Pause ();
//
//
//        playerJet2 = (GameObject)Instantiate(jet, player.obj.transform.position, Quaternion.identity);
//        playerJet2.transform.parent = player.obj.transform;
//        playerJet2.transform.localRotation = Quaternion.Euler (new Vector3(90, 0, 0));
//        playerJet2.transform.localPosition = new Vector3 (2.5f, 1.89f, -0.7f);
//        playerJet2.GetComponent<ParticleSystem> ().loop = false;
//        playerJet2.GetComponent<ParticleSystem> ().startSize = 5;
//        playerJet2.GetComponent<ParticleSystem> ().Pause ();
    }
Beispiel #2
0
    void Awake()
    {
        chunk = Vox.LoadModel("models/player_stand.vox", "object");
        chunk.obj.transform.position = new Vector3(30, 10, 100);
        chunk.obj.name = "Enemy";

        //chunk.obj.AddComponent<MeshCollider> ();
        chunk.obj.AddComponent <Rigidbody> ();
        chunk.obj.GetComponent <MeshCollider> ().convex      = true;
        chunk.obj.GetComponent <Rigidbody> ().sleepThreshold = 1.0f;
        chunk.obj.GetComponent <Rigidbody> ().mass           = 10;
        chunk.obj.GetComponent <Rigidbody> ().isKinematic    = true;
        chunk.obj.GetComponent <Rigidbody> ().angularDrag    = 0.09f;
    }