示例#1
0
    IEnumerator Spawn(SpawnedEnemy _enemy)
    {
        //wait initial time
        yield return(new WaitForSeconds(_enemy.initialDelay));

        //continue spawning enemies at delayed times until reaches amount
        for (int i = 0; i < _enemy.amount; i++)
        {
            Instantiate(_enemy.enemyPrefab, _enemy.position.position, _enemy.position.rotation);
            yield return(new WaitForSeconds(_enemy.subsequentDelay));
        }
    }
示例#2
0
    void SpawnEnemy()
    {
        if (currentEnemyCount >= data[dataIndex].maxEnemies)
        {
            return;
        }

        GameObject SpawnedEnemy;

        SpawnedEnemy = Instantiate(EnemyToSpawn, GetSpawnPoint(), Quaternion.identity, null);

        currentEnemyCount++;

        //set ref to spawner
        AI_Base Enemy = SpawnedEnemy.GetComponent <AI_Base>();

        if (Enemy != null)
        {
            Enemy.SetSpawner(this);
        }
    }
示例#3
0
    private void CompleteMission()
    {
        if (missionCompleting || respawning)
        {
            return;
        }

        RegionManager.Instance.finalHallwayDoor.OnPlayerPassThrough -= CompleteMission;
        missionCompleting = true;

        FMODUnity.RuntimeManager.StudioSystem.setParameterByName("ChaseEnd", 1f);

        spawnedEnemies.ForEach(e =>
        {
            e.pureChaser.enemy.OnCollideWithPlayer -= RestartAfterCutscene;
            e.pureChaser.enemy.enabled              = false;
            e.pureChaser.StartCleaning();
            e.pureChaser.enabled       = false;
            e.pureChaser.agent.enabled = false;

            e.gameObject.GetComponent <CinemachineCollisionImpulseSource>().enabled = false;
            e.gameObject.GetComponent <Collider>().isTrigger    = false;
            e.gameObject.GetComponent <Rigidbody>().isKinematic = false;

            e.npcBark.StopCurrentBark();

            e.gameObject.GetComponent <SpeakerUI>().SetIsClamp(true);
        });

        // Trigger the final bark set for only the first enemy
        if (spawnedEnemies.Count > 0)
        {
            spawnedEnemies[0].npcBark.TriggerBark(NPCBarkTriggerType.TutorialChaseOver);
        }

        // finally stop all barks completely after the final one being triggered, and start setting up cleaning conversations
        spawnedEnemies.ForEach(e =>
        {
            e.npcBark.enabled         = false;
            e.npcInteractable.enabled = true;
        });

        // Assign all conversations
        int currentEnemyIndex = 0;

        foreach (Conversation conversation in cleaningConversations)
        {
            Conversation conversationCopy = Conversation.CreateCopy(conversation);

            SpawnedEnemy currentEnemy = spawnedEnemies[currentEnemyIndex % spawnedEnemies.Count];
            for (int i = 0; i < conversationCopy.lines.Length; i++)
            {
                if (string.IsNullOrEmpty(conversationCopy.lines[i].id.Trim()))
                {
                    conversationCopy.lines[i].id = DialogueManager.Instance.GetSpeakerId(currentEnemy.gameObject);
                }
            }
            currentEnemy.npcInteractable.defaultConvos.Add(conversationCopy);
            currentEnemyIndex++;
        }

        AlertMissionComplete();
        MissionManager.Instance.EndMission(MissionsEnum.MissionTutorial);
    }