Example #1
0
 static void hero_moveto(string heroId, int mapId, float mapX, float mapY, float mapZ, float dirX, float dirY, float dirZ)
 {
     //Roledata data =  playerData.GetInstance().nearList[int.Parse(heroId)];
     // if (data == null)
     //     return;
     //  GameObject obj = data.model;
     //if(obj)
     {
         OtherPlayer other = GameObject.FindObjectOfType <OtherPlayer>();// (OtherPlayer)(CharacterManager.instance.transform.GetComponentsInChildren<OtherPlayer>()[0]);//obj.GetComponent<PlayerMotion>();
         if (other)
         {
             other.GetComponent <PlayerMotion>().Move(new Vector3(mapX, mapY, mapZ));
             other.GetComponent <PlayerMotion>().Rotation(new Vector3(dirX, dirY, dirZ));
         }
     }
     // data.model.
     Debug.Log(string.Format("hero_moveto:heroId={0},mapId={1},mapX={2},mapY={3},mapZ={4},dirX={5},dirY={6},dirZ={7}", heroId, mapId, mapX, mapY, mapZ, dirX, dirY, dirZ));
 }
Example #2
0
 void OnCollisionEnter(Collision Hit)
 {
     if (Hit.gameObject.tag == "Death" || Hit.gameObject.tag == "P1" || Hit.gameObject.tag == "P2")
     {
         Instantiate(Explosion, transform.position, transform.rotation);
         Cursor.visible   = true;
         Cursor.lockState = CursorLockMode.None;
         if (Hit.gameObject.tag == "Death")
         {
             GameObject OtherPlayer;
             if (P1)
             {
                 OtherPlayer = GameObject.Find("Car P2");
                 OtherPlayer.GetComponent <Rigidbody>().isKinematic = true;
                 GameObject C = GameObject.Find("Main Camera " + OtherPlayer.tag);
                 C.tag = "Win Camera";
                 foreach (Renderer MR in OtherPlayer.GetComponentsInChildren <MeshRenderer>())
                 {
                     MR.enabled = false;
                 }
                 foreach (ParticleSystem PS in OtherPlayer.GetComponentsInChildren <ParticleSystem>())
                 {
                     PS.enableEmission = false;
                 }
                 P2Wins.SetActive(true);
             }
             else
             {
                 OtherPlayer = GameObject.Find("Car P1");
                 OtherPlayer.GetComponent <Rigidbody>().isKinematic = true;
                 GameObject C = GameObject.Find("Main Camera " + OtherPlayer.tag);
                 C.tag = "Win Camera";
                 foreach (Renderer MR in OtherPlayer.GetComponentsInChildren <MeshRenderer>())
                 {
                     MR.enabled = false;
                 }
                 foreach (ParticleSystem PS in OtherPlayer.GetComponentsInChildren <ParticleSystem>())
                 {
                     PS.enableEmission = false;
                 }
                 P1Wins.SetActive(true);
             }
         }
         else
         {
             Draw.SetActive(true);
             GameObject C = GameObject.Find("Main Camera P1");
             C.tag = "Win Camera";
         }
         EndScreen.SetActive(true);
         foreach (GameObject G in GameObject.FindGameObjectsWithTag("Death"))
         {
             if (G.name == "Death Trail(Clone)")
             {
                 Destroy(G);
             }
         }
         RB.isKinematic = true;
         foreach (Renderer MR in GetComponentsInChildren <MeshRenderer>())
         {
             MR.enabled = false;
         }
         foreach (ParticleSystem PS in GetComponentsInChildren <ParticleSystem>())
         {
             PS.enableEmission = false;
         }
     }
 }