Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- public class NewPlayerIndividual : NetworkBehaviour {
- public GameObject TankPrefab;
- public GameObject myTank;
- public int playerID;
- public int posX;
- // Use this for initialization
- void Start () {
- if (!isServer)
- {
- playerID = MultiplayerManager.connectionID;
- print(playerID.ToString());
- }
- if (playerID == SuperGameManager.connID) SuperGameManager.mainPlayer = this;
- //Lo mando al manager en vez de hacerlo directamente para que se haga en los dos clientes
- MultiplayerManager.instance.SpawnPlayer(playerID);
- }
- // Update is called once per frame
- void Update () {
- }
- public void CreateTank(int connID)
- {
- GameObject tank = Instantiate(TankPrefab);
- if (connID != playerID)
- {
- posX = 40;
- tank.transform.position = new Vector3(posX, 1.2f, 0);
- }
- else
- {
- posX = -40;
- tank.transform.position = new Vector3(posX, 1.2f, 0);
- myTank = tank;
- myTank.GetComponent<TankInputs>().canBeUsed = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement