// Update is called once per frame void Update() { if (NetworkManager.Instance.IsServer) { if (blueTeamDead.Count > 0) { if (TimeMachine.blueTimeMachine.MAvalableLaboreres.Count > 0) { Debug.Log("respawning player as blue"); NetworkingPlayer toGive = blueTeamDead.Dequeue(); RMManager obj = TimeMachine.blueTimeMachine.MAvalableLaboreres.Dequeue(); obj.networkObject.Destroy(); RobotManagerBehavior behavior = NetworkManager.Instance.InstantiateRobotManager(); StartCoroutine(respawnPlayer(behavior, 2, toGive, 0.1f)); } } if (redTeamDead.Count > 0) { Debug.Log("this is right"); if (TimeMachine.redTimeMachine.MAvalableLaboreres.Count > 0) { Debug.Log("respawning player as red"); NetworkingPlayer toGive = redTeamDead.Dequeue(); RMManager obj = TimeMachine.redTimeMachine.MAvalableLaboreres.Dequeue(); obj.networkObject.Destroy(); RobotManagerBehavior behavior = NetworkManager.Instance.InstantiateRobotManager(); StartCoroutine(respawnPlayer(behavior, 1, toGive, 0.1f)); } } } }
void Start() { rigid = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); agent = GetComponent <NavMeshAgent>(); agent.updateRotation = false; robotManager = GetComponentInParent <RMManager>(); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); rigid = GetComponentInChildren <Rigidbody>(); robotManger = GetComponentInParent <RMManager>(); }
public void MAddLaborerToAvailableLaborer(RMManager controller) { multiplayer = true; MAvalableLaboreres.Enqueue(controller); }