Exemplo n.º 1
0
 // Use this for initialization
 void Start ()
 {
     NLH = GameObject.Find("LobbyManager").GetComponent<NetworkLobbyHook>();
     LM = GameObject.Find("LobbyManager").GetComponent<UnityStandardAssets.Network.LobbyManager>();
     checkingPlayers = LM.PlayersOnline.Count;
     //Tells the player what its name is
     gameObject.name = playerName;
     //Renderar the colour and the texture player had choosen ealier
     Renderer[] CRends = GetComponentsInChildren<Renderer>();
     if(checkingTexture == 1)
     {
         playertexture = selectableTextures[0];
     }
     if (checkingTexture == 2)
     {
         playertexture = selectableTextures[1];
     }
     if (checkingTexture == 3)
     {
         playertexture = selectableTextures[2];
     }
     Color headcolor = GameObject.Find(this.gameObject.name + "/Body/regular_dude_body").GetComponent<Renderer>().material.color;
     foreach (Renderer r in CRends)
     {
         r.material.mainTexture = playertexture;
         r.material.color = color;
     }
     GameObject.Find(this.gameObject.name + "/Body/regular_dude_head").GetComponent<Renderer>().material.color = headcolor;
     //Two Materials
     /*     GameObject.Find(this.gameObject.name + "/Body/regular_dude_right_hand").GetComponent<Renderer>().material.color = headcolor;
          GameObject.Find(this.gameObject.name + "/Body/regular_dude_right_hand").GetComponent<Renderer>().material.color = headcolor;*/
 }
Exemplo n.º 2
0
	private DodgeBallBehaviour ballInfo; //Script on the ball colliding with the player;

	// Use this for initialization
	void Start () {
		gat = gameObject.GetComponent<GrabAndToss> ();
		NLH = GameObject.Find("LobbyManager").GetComponent<NetworkLobbyHook>();
		netInfo = gameObject.GetComponent<NetworkCharacterInfo> ();
	}
Exemplo n.º 3
0
    // Vector3 playerPosition;

    // Transform myTransform;



    // Use this for initialization

    void Start()
    {
        //lobby = GameObject.Find("LobbyManager").GetComponent<NetworkLobbyHook>();

        transform.position = new Vector3(Random.Range(-200f, -250f), Random.Range(400f, 500f), Random.Range(-200f, -250f));
        // transform.position = new Vector3(500, 192, 500);

        // set the vertical offset to the object's collider bounds' extends
        if (GetComponent <Collider>() != null)
        {
            radius = GetComponent <Collider>().bounds.extents.y;
        }
        else
        {
            radius = 1f;
        }

        // raycast to find the y-position of the masked collider at the transforms x/z
        RaycastHit hit;
        // note that the ray starts at 100 units
        Ray ray = new Ray(transform.position + Vector3.up * 100, Vector3.down);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask))
        {
            if (hit.collider != null)
            {
                // this is where the gameobject is actually put on the ground
                transform.position = new Vector3(transform.position.x, hit.point.y + radius, transform.position.z);
            }
        }

        lobby = GameObject.Find("LobbyManager").GetComponent <NetworkLobbyHook>();



        if (!isLocalPlayer)

        {
            DisableComponents();

            AssignRemoteLayer();
        }

        else

        {
            // Camera.main.gameObject.SetActive(false);
            // print("ctre : "+componentsToDisable[0].gameObject.active);

            componentsToDisable[0].gameObject.SetActive(true);

            sceneCamera = Camera.main;

            if (sceneCamera != null)

            {
                sceneCamera.gameObject.SetActive(false);
            }



            // StartCoroutine(UpdatePosition());
        }



        //RegisterPlayer(); ibra
    }