public void CmdSpawn(SpawnClass sClass) { _currentClass = sClass; switch (sClass) { case global::SpawnClass.Technician: GameObject obj = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [3], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity); NetworkServer.Destroy(this.gameObject); NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj, this.playerControllerId); break; case global::SpawnClass.Support: GameObject obj2 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [0], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity); NetworkServer.Destroy(this.gameObject); NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj2, this.playerControllerId); break; case global::SpawnClass.Heavy: GameObject obj3 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [4], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity); NetworkServer.Destroy(this.gameObject); NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj3, this.playerControllerId); break; case global::SpawnClass.Assault: GameObject obj4 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [5], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity); NetworkServer.Destroy(this.gameObject); NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj4, this.playerControllerId); break; } }
public void Spawn() { SpawnClass SpawnMonster = bestiaire[Random.Range(0, bestiaire.Length)]; Vector3 rotation = new Vector3(SpawnMonster.rEuler.x + Random.Range(-15, 15), SpawnMonster.rEuler.y + Random.Range(-15, 15), SpawnMonster.rEuler.z + Random.Range(-15, 15)); Instantiate(SpawnMonster.MonsterToSpawn, (SpawnMonster.spawnSphere[Random.Range(0, SpawnMonster.spawnSphere.Length - 1)].position), Quaternion.Euler(rotation)); Invoke("Spawn", Random.Range(ApparitionMin, ApparitionMax)); }
public void SpawnClass(SpawnClass sClass) { if (_currentClass != sClass) { CmdSpawn(sClass); } else { this.transform.position = SpawnPointManager.Instance.SpawnPointLocation(1); } GameManager.Instance.OnCharacterSpawn(sClass); }
public void OnCharacterSpawn(SpawnClass sClass) { int cost = 0; switch (sClass) { case SpawnClass.Technician: case SpawnClass.Support: cost = 1; break; case SpawnClass.Heavy: case SpawnClass.Assault: cost = 3; break; } UpdateTicketAmount(-(cost)); }