Пример #1
0
    public override void Setup(int x, int z, string name, RoomType typeOfRoom, bool[] doors, GameObject[] wallObjects)
    {
        base.Setup(x, z, name, RoomType.Secure, doors, wallObjects);

        hasAlerted  = false;
        enemyPrefab = null;

        AudienceInteractable temp = gameObject.AddComponent <EnemySpawnInteractable>();

        InitAudienceInteractable(temp);
        audienceInteractables.Add(temp);

        temp = gameObject.AddComponent <EnemyIncapacitateInteractable>();
        InitAudienceInteractable(temp);
        audienceInteractables.Add(temp);

        CheckInteractablesInRoom();

        nodes = new List <Transform>();

        foreach (Transform child in guardWalkNodes.transform)
        {
            if (child.gameObject.activeInHierarchy)
            {
                nodes.Add(child);
            }
        }

        enemiesOwnedByRoom = new List <Enemy>();

        MainObjective.ActionLockDown += NotifyEnemiesOfPlayer;
    }
Пример #2
0
    protected void InitAudienceInteractable(AudienceInteractable audInt)
    {
        InteractableState state = Random.value > 0.5 ? InteractableState.negative : InteractableState.positive;

        audInt.InitializeInteractable(roomName, state, this);
        audienceInteractables.Add(audInt);
    }
Пример #3
0
    private void CheckInteractablesInRoom()
    {
        Transform firstChild = transform.GetChild(0);

        foreach (Transform t in firstChild)
        {
            AudienceInteractable audInt = t.GetComponent <AudienceInteractable>();

            if (audInt != null)
            {
                InitAudienceInteractable(audInt);
            }
        }
    }
Пример #4
0
    public AudienceInteractable SpawnObject()
    {
        int possibilities = spawnableObjects.Count;

        int chosenIndex = Random.Range(0, possibilities);

        GameObject spawnedObject = Instantiate(spawnableObjects[chosenIndex], transform.position, transform.rotation);

        spawnedObject.transform.SetParent(transform.parent.parent);

        AudienceInteractable audInt = spawnedObject.GetComponent <AudienceInteractable>();

        Destroy(gameObject);

        return(audInt);
    }
Пример #5
0
    public virtual void Setup(int x, int z, string name, RoomType typeOfRoom, bool[] doors, GameObject[] wallObjects)
    {
        roomName = name;
        roomType = typeOfRoom;

        X = x;
        Z = z;

        foreach (RoomTrigger trigger in roomTriggers)
        {
            trigger.SetupTrigger(this);
        }

        audienceInteractables = new List <AudienceInteractable>();

        // Spawn walls after creating interactables to add
        // doors to the list
        SpawnWalls(doors, wallObjects);

        foreach (ObjectSpawnNode node in spawnNodes)
        {
            AudienceInteractable audInt = node.SpawnObject();

            if (audInt != null)
            {
                InitAudienceInteractable(audInt);
            }
        }

        foreach (Transform child in transform)
        {
            if (child.gameObject.CompareTag("Minimap"))
            {
                minimapObject = child.gameObject;
                discoveredMat = minimapObject.GetComponent <MeshRenderer>().material;
                break;
            }
        }

        spawnNodes.Clear();
    }
Пример #6
0
    private void CheckValues()
    {
        // Check Good Values
        for (int i = 0; i < 3; i++)
        {
            interactableUI[i].UpdateBox(goodDataValues[i]);

            if (goodDataValues[i] >= 1.0f)
            {
                // this is the winner
                int ID = goodChosenData[i].ID;
                InteractableState state = goodChosenData[i].necessaryState;

                ActionLockFaction(1, 1, goodChosenData[i].tag);
                goodFactionLocked = true;

                ActionFlashInteractable(true, goodChosenData[i].icon);

                ActionAddInteractable(goodChosenData[i].ID, true);

                // If the chosen interactable does not have a physical location
                if (ID == 4)
                {
                    GetComponent <LocateMainObjectiveInteractable>().Execute();
                    ActionInteractableChosen(RoomManager.instance.GetCurrentRoom().transform.position, true);

                    SoundRequest.RequestSound("Ping");
                }
                else
                {
                    // Get nearby object with that ID and State
                    AudienceInteractable chosenInteractable = RoomManager.instance.GetInteractableOfType(ID, state);

                    //ActionInteractableChosen
                    if (chosenInteractable != null)
                    {
                        chosenInteractable.Execute();
                        ActionInteractableChosen(chosenInteractable.transform.position, true);
                        SoundRequest.RequestSound("Ping");
                    }
                    else
                    {
                        Debug.LogError("No Interactable Possible");
                    }
                }

                TurnOffDisplay(0, i); // Turns off all except for the given display
                goodDataValues = new float[] { 0.0f, 0.0f, 0.0f };
            }
        }

        // Check Bad Values
        for (int i = 0; i < 3; i++)
        {
            interactableUI[i + 3].UpdateBox(badDataValues[i]);

            if (badDataValues[i] >= 1.0f)
            {
                if (badDataValues[i] >= 1.0f)
                {
                    // this is the winner
                    int ID = badChosenData[i].ID;
                    InteractableState state = badChosenData[i].necessaryState;

                    // Get nearby object with that ID and State
                    AudienceInteractable chosenInteractable = RoomManager.instance.GetInteractableOfType(ID, state);

                    ActionLockFaction(0, 1, badChosenData[i].tag);
                    ActionFlashInteractable(false, badChosenData[i].icon);
                    badFactionLocked = true;

                    ActionAddInteractable(badChosenData[i].ID, false);

                    //ActionInteractableChosen
                    if (chosenInteractable != null)
                    {
                        chosenInteractable.Execute();
                        ActionInteractableChosen(chosenInteractable.transform.position, false);
                        SoundRequest.RequestSound("Ping");
                    }
                    else
                    {
                        Debug.LogError("No Interactable Possible");
                    }

                    TurnOffDisplay(1, i); // Turns off all except for the given display
                    badDataValues = new float[] { 0.0f, 0.0f, 0.0f };
                }
            }
        }
    }