예제 #1
0
    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);
        }
    }
예제 #2
0
    void Spawn()
    {
        transform.position = _spawnPointManager.GetRandomSpawnPoint(_player.teamComponent.team);
        _player.healthComponent.enabled = true;
        _graphicsGO.SetActive(true);

        OnSpawn?.Invoke();
    }
예제 #3
0
    public Mover SpawnMover()
    {
        var moverObject = Instantiate(moverPrefab, _spawnPointManager.GetRandomSpawnPoint(), Quaternion.identity);
        var mover       = moverObject.GetComponent <Mover>();

        _movers.Add(mover);

        return(mover);
    }
예제 #4
0
    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);
    }
예제 #5
0
    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();
        }
    }
예제 #6
0
    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;
    }