Exemplo n.º 1
0
    private void SpawnEnemies()
    {
        chaserGroups.ForEach(group =>
        {
            group.enemyStartPositions.ForEach(position =>
            {
                GameObject enemyInstance           = Instantiate(chaserPrefabs[Random.Range(0, chaserPrefabs.Count)], position, Quaternion.identity);
                Vector3 originalScale              = enemyInstance.transform.localScale;
                enemyInstance.transform.localScale = new Vector3(
                    originalScale.x * Random.Range(randomWidthMultiplierRange.x, randomWidthMultiplierRange.y),
                    originalScale.y * Random.Range(randomHeightMultiplierRange.x, randomHeightMultiplierRange.y),
                    originalScale.z * Random.Range(randomWidthMultiplierRange.x, randomWidthMultiplierRange.y));

                PureChaser chaser      = Utils.GetRequiredComponent <PureChaser>(enemyInstance);
                chaser.targetTransform = GameManager.Instance.GetPlayerTransform();
                chaser.SetSpeed(group.chaseSpeed);
                chaser.startChaseRadius           = group.startChaseRadius;
                chaser.enemy.OnCollideWithPlayer += RestartAfterCutscene;

                NPCBark npcBark = Utils.GetRequiredComponent <NPCBark>(enemyInstance);
                NPCInteractable npcInteractable = Utils.GetRequiredComponent <NPCInteractable>(enemyInstance);
                npcInteractable.enabled         = false;

                spawnedEnemies.Add(new SpawnedEnemy(enemyInstance, chaser, group, npcBark, npcInteractable));
            });
        });
    }
Exemplo n.º 2
0
    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "NPC")
        {
            Debug.Log("NPC");

            if (XCI.GetButtonDown(XboxButton.B) && dialogue.IsTalking == false)
            {
                dialogue.DialogBox.SetActive(true);
                dialogue.IsTalking = true;
                TriggerConvo       = other.transform.gameObject.GetComponent <NPCInteractable>();
                TriggerConvo.TriggerDialogue();
                Pause = false;
            }
            Talk.SetActive(true);
        }
        if (other.gameObject.tag == "GameMaker")
        {
            Debug.Log("GameMaker");

            if (XCI.GetButtonDown(XboxButton.B) && dialogue.IsTalking == false)
            {
                dialogue.DialogBox.SetActive(true);
                dialogue.ActivateMiniGame = true;
                TriggerConvo = other.transform.gameObject.GetComponent <NPCInteractable>();
                TriggerConvo.TriggerDialogue();
                Pause = false;
            }
            Talk.SetActive(true);
        }
    }
Exemplo n.º 3
0
 public SpawnedEnemy(GameObject gameObject, PureChaser pureChaser, TutorialChaserGroup chaserGroup, NPCBark npcBark, NPCInteractable npcInteractable)
 {
     this.gameObject      = gameObject;
     this.pureChaser      = pureChaser;
     this.chaserGroup     = chaserGroup;
     this.npcBark         = npcBark;
     this.npcInteractable = npcInteractable;
 }
Exemplo n.º 4
0
    protected override void Awake()
    {
        base.Awake();

        inventory = gameObject.GetComponent <Inventory>();
        inventory.SetIndependent(false);         // set the inventory as dependent on the NPC

        interactable = gameObject.GetComponent <NPCInteractable>();

        UpdateSortingLayer();
    }
Exemplo n.º 5
0
    private void FinishInteraction()
    {
        if (activeInstance == this)
        {
            activeInstance = null;
        }
        player.EnableButtonB();

        DestroyInteractPopups();

        npc.Resume();
        player.Resume();
    }
Exemplo n.º 6
0
    private void StartInteraction()
    {
        activeInstance = this;
        player.DisableButtonB();

        npc.Pause();
        player.Pause();

        if (!npc.IsKnockedOut())
        {
            InitSpeechBubble();
        }
        InitNPCOptions();
        DestroyHoverText(); // avoid overlap with speech bubble
    }
Exemplo n.º 7
0
    public override void Act()
    {
        if (target == null)
        {
            return;
        }

        NPCInteractable npc = target.GetComponent <NPCInteractable>();
        {
            if (npc != null)
            {
                npc.Talk();
            }
        }
    }
Exemplo n.º 8
0
        //void LateUpdate()
        //{
        //    if (isTalking)
        //    {
        //        if (!EventSystem.current.IsPointerOverGameObject())
        //        {
        //            if (Input.GetKeyDown(KeyCode.Escape) || Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
        //            {
        //                focusedNPC.GetComponent<NPCMovement>().isTalking = false;

        //                focusedNPC = null;

        //                ToggleTalkState();

        //                dialogueManager.CloseDialogueWindow();
        //            }
        //        }
        //    }
        //}

        //public void ToggleTalkState()
        //{
        //    isTalking = !isTalking;

        //    if (isTalking)
        //    {
        //        navMeshAgent.SetDestination(transform.position);
        //        inputManager.disabled = true;
        //    }
        //    else
        //    {
        //        inputManager.disabled = false;
        //    }
        //}

        private void HandleNPCInteraction(RaycastHit hit)
        {
            if (hit.transform.TryGetComponent <NPCInteractable>(out var npc))
            {
                npc.HighlightNpc();
                highlightedNPC = npc;
            }
            else
            {
                if (highlightedNPC)
                {
                    highlightedNPC.UnhighlightNpc();
                    highlightedNPC = null;
                }
            }
        }
Exemplo n.º 9
0
    // Called by Signal Emitter in Unity Timeline
    public void SetupNurseRoom()
    {
        frankBeforeMission.transform.position = frankPosition;
        frankBeforeMission.transform.rotation = Quaternion.Euler(frankRotation);
        NPCInteractable npcInteractable = Utils.GetRequiredComponent <NPCInteractable>(frankBeforeMission);

        npcInteractable.ResetAllConversations();
        npcInteractable.defaultConvos = new List <Conversation>()
        {
            finalConversation
        };
        npcInteractable.conversation = finalConversation;

        // Perfect positioning of all the nurse room escape objects
        escapeTable.transform.position = tablePosition;
        escapeTable.transform.rotation = Quaternion.Euler(tableRotation);
        tableRadio.transform.position  = radioPosition;
        tableRadio.transform.rotation  = Quaternion.Euler(radioRotation);
    }