public void CmdMakeMob() { Vector3 StartPos = Vector3.zero; Vector3 EndPos = Vector3.zero; GameObject colorGo = mobBlue; if (pCommmon.GetTeam() == 1) { StartPos = DemoMgr.singleton.targetPosBlue.position; EndPos = DemoMgr.singleton.targetPosRed.position; colorGo = mobBlue; } else if (pCommmon.GetTeam() == 2) { StartPos = DemoMgr.singleton.targetPosRed.position; EndPos = DemoMgr.singleton.targetPosBlue.position; colorGo = mobRed; } GameObject mobGo = (GameObject)GameObject.Instantiate(colorGo, StartPos, Quaternion.identity); NavMeshAgent nma = mobGo.GetComponent <NavMeshAgent>(); nma.destination = EndPos; GameObject.Destroy(mobGo, 10.0f); mobGo.GetComponent <MobServer>().InitData(pCommmon.GetTeam()); NetworkServer.Spawn(mobGo); }
void Update() { if (!isLocalPlayer) { return; } if (singleton == null) { return; } if (!login) { if (pCommmon.GetTeam() == 2) { DemoMgr.singleton.Set2pComps(); login = true; } } }