public void StartMatch() { GameObject player = Instantiate(playerPrefab, m_spawnPointManager.GetRandomSpawnPoint(true), playerPrefab.transform.rotation); SceneManager.MoveGameObjectToScene(player, gameObject.scene); ActorsKills.Add(player, 0); ActorsDeaths.Add(player, 0); for (int i = 0; i < numberOfEnemies; i++) { GameObject go = Instantiate(enemyPrefab, m_spawnPointManager.GetRandomSpawnPoint(true), enemyPrefab.transform.rotation); SceneManager.MoveGameObjectToScene(go, gameObject.scene); ActorsKills.Add(go, 0); ActorsDeaths.Add(go, 0); } }
void Spawn() { transform.position = _spawnPointManager.GetRandomSpawnPoint(_player.teamComponent.team); _player.healthComponent.enabled = true; _graphicsGO.SetActive(true); OnSpawn?.Invoke(); }
public Mover SpawnMover() { var moverObject = Instantiate(moverPrefab, _spawnPointManager.GetRandomSpawnPoint(), Quaternion.identity); var mover = moverObject.GetComponent <Mover>(); _movers.Add(mover); return(mover); }
public bool Spook() { if (_claimedMemento != null && _claimedMemento.mementoState == Memento.MementoState.PickedUp) { _spooked = true; _animator.SetTrigger("Scared"); _claimedMemento.Drop(); _mementoManager.ForfeitMemento(_claimedMemento); _claimedMemento = null; audioSource.PlayOneShot(spookedSounds[Random.Range(0, spookedSounds.Length)]); _destination = _spawnPointManager.GetRandomSpawnPoint(); _navMeshAgent.speed = settings.scaredSpeed; return(true); } return(false); }
private void SpawnAllTanks() { List <Transform> usedTransforms = new List <Transform>(); for (int i = 0; i < m_Tanks.Length; i++) { Transform spawnPoint = null; do { spawnPoint = m_SpawnPointManager.GetRandomSpawnPoint(); } while (usedTransforms.Contains(spawnPoint)); usedTransforms.Add(spawnPoint); m_Tanks[i].m_Instance = Instantiate(m_TankPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject; m_Tanks[i].m_PlayerNumber = i + 1; m_Tanks[i].Setup(); } }
public IEnumerator Respawn(bool atRandomPoint = true) { print("start of respawn"); mIsDisabled = false; mIsDead = false; mIsInvolnurable = true; isRespawning = true; if (atRandomPoint) { transform.position = mSpawnManager.GetRandomSpawnPoint(); } else { transform.position = mSpawnManager.GetNextSpawnPoint(); } transform.rotation = Quaternion.identity; yield return(StartCoroutine(PopOutAndIn())); float startTime = Time.time; while (startTime + involnurableTime > Time.time) { mAvatarGraphicsMain.renderer.enabled = !mAvatarGraphicsMain.renderer.enabled; mAvatarGraphicsOverlay.renderer.enabled = !mAvatarGraphicsOverlay.renderer.enabled; yield return(new WaitForSeconds(involnurableBlinkTime)); } mAvatarGraphicsMain.renderer.enabled = true; mAvatarGraphicsOverlay.renderer.enabled = true; isRespawning = false; mIsInvolnurable = false; }