Exemple #1
0
        public int CompareTo(object obj)
        {
            var other = obj as PartialSnapshotCompression;

            if (other == null)
            {
                return(1);
            }
            if (Equals(other))
            {
                return(0);
            }

            int result = CompressionType.CompareTo(other.CompressionType);

            if (result != 0)
            {
                return(result);
            }

            result = FieldOfVision.CompareTo(other.FieldOfVision);
            if (result != 0)
            {
                return(result);
            }

            result = Direction.CompareTo(other.Direction);
            if (result != 0)
            {
                return(result);
            }

            if (ChildNodes.Any())
            {
                var sortedNodes      = new List <IPartialSnapshotCompressionNode>();
                var otherSortedNodes = new List <IPartialSnapshotCompressionNode>();
                sortedNodes.AddRange(ChildNodes);
                otherSortedNodes.AddRange(other.ChildNodes);
                sortedNodes.Sort();
                otherSortedNodes.Sort();

                for (int i = 0; i < sortedNodes.Count; i++)
                {
                    if (otherSortedNodes.Count <= i)
                    {
                        return(-1);
                    }
                    if (!sortedNodes[i].Equals(otherSortedNodes[i]))
                    {
                        return(sortedNodes[i].CompareTo(otherSortedNodes[i]));
                    }
                }
            }

            return(ChildNodes.Count.CompareTo(other.ChildNodes.Count));
        }
Exemple #2
0
        private void Start()
        {
            InvokeRepeating(nameof(ReacquireTarget), 0f, reacquireInterval);
            FMODUnity.RuntimeManager.StudioSystem.setParameterByName("playerCaught", 0f);

            fieldOfVision = GetComponent <FieldOfVision>();
            if (fieldOfVision)
            {
                fieldOfVision.OnTargetsUpdated += HandleTargetsInRange;
            }
        }
Exemple #3
0
        public override int GetHashCode()
        {
            if (Id >= 0)
            {
                return(Id.GetHashCode());
            }

            double result = FieldOfVision.GetHashCode();

            foreach (var sensoryPattern in SensoryPatterns)
            {
                result += sensoryPattern.GetHashCode();
            }
            // ToDo: Check integer overflow ... how should this be handled?
            return((int)result);
        }
    void OnSceneGUI()
    {
        FieldOfVision fow = (FieldOfVision)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius);
        Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false);
        Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false);

        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius);
        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fow.visibleTargets)
        {
            Handles.DrawLine(fow.transform.position, visibleTarget.position);
        }
    }
Exemple #5
0
    void Start()
    {
        enemySight    = GetComponentInChildren <EnemySight>();
        fieldOfVision = GetComponentInChildren <FieldOfVision>();

        //set angle
        enemySight.setConeSize(fieldViewAngle / 2);                 //degrees
        fieldOfVision.setAngle(fieldViewAngle * Mathf.Deg2Rad / 2); //in radians

        //set radius - need to adjust for weird scaling
        //Debug.Log(enemyFront.transform.localScale.x);
        enemySight.setColliderRadius(fieldDepth);
        fieldOfVision.setSightRange(fieldDepth / (1 / enemyFront.transform.localScale.x));


        //set the raycast height
        enemySight.setRaycastHeight(enemyEyeHeight);

        //set number of rays in the raycast
        fieldOfVision.setRaysToCast(raysInCast);
    }
    private IEnumerator StartMissionLogic()
    {
        // The starting rolling text... maybe one day we'll remove this
        foreach (string text in startCutsceneTexts)
        {
            yield return(UIManager.Instance.textOverlay.SetText(text));
        }
        UIManager.Instance.zoneText.ClearText(); // instant clear it to type it out when we fade in later

        // Tutorial Nurse Section Init: add as speaker, init with ai components to respond to certain events
        tutorialNurse.spawnedInstance = MissionManager.Instance.SpawnMissionObject(tutorialNurse);
        DialogueManager.Instance.AddSpeaker(
            new SpeakerContainer(
                tutorialNurseSpeakerId,
                tutorialNurse.spawnedInstance,
                tutorialNurseVoicePath));
        tutorialNurseAI = Utils.GetRequiredComponent <TutorialNurse>(tutorialNurse.spawnedInstance);
        tutorialNurseAI.OnCouldNotFindBirdie += HandleCouldNotFindBirdie;      // make the ai freak out when they cant find birdie
        tutorialNurseFOV = Utils.GetRequiredComponent <FieldOfVision>(tutorialNurse.spawnedInstance);
        tutorialNurseFOV.OnTargetSpotted += HandleTutorialNurseSpottingPlayer; // we can handle convos that occur when nurse spots birdie

        // Spawn the other bed NPC by the window
        otherBedNPC.spawnedInstance = MissionManager.Instance.SpawnMissionObject(otherBedNPC);
        DialogueManager.Instance.AddSpeaker(
            new SpeakerContainer(
                otherBedNPCSpeakerId,
                otherBedNPC.spawnedInstance,
                otherBedNPCVoicePath));
        if (otherBedNPCConversations.Count == 0)
        {
            Debug.LogError("Need at least one conversation set for otherBedNPCConversations!");
        }
        else
        {
            currentOtherNPCConversation = otherBedNPCConversations.First();
            otherBedNPC.spawnedInstance.GetComponent <NPCInteractable>().defaultConvos = new List <Conversation>()
            {
                currentOtherNPCConversation
            };
            otherBedNPCConversations.RemoveAt(0);
            DialogueManager.Instance.OnFinishConversation += LoadNextOtherNPCConversation;
        }

        // Fade in and allow to pause, and lock the door to start
        UIManager.Instance.FadeIn();
        UIManager.Instance.CanPause = true;
        RegionManager.Instance.nurseRoomDoor.SetLocked(true);
        RegionManager.Instance.nurseRoomDoor.OnPlayerCollideWithDoor += OnPlayerCollideWithNurseRoomDoor;

        // Wake up cutscene + enabling movement afterwards
        if (!GameManager.Instance.skipSettings.allRealtimeCutscenes)
        {
            GameManager.Instance.GetPlayerAnimator().SetTrigger(Constants.ANIMATION_BIRDIE_WAKEUP);
            float animationLength = GameManager.Instance.GetPlayerAnimator().GetCurrentAnimatorClipInfo(0)[0].clip.length; // should always be there
            yield return(new WaitForSeconds(animationLength * 0.8f));                                                      // fine-tuned for best visuals
        }
        GameManager.Instance.GetPlayerRigidbody().isKinematic        = false;
        GameManager.Instance.GetPlayerController().EnablePlayerInput = true;

        // we type it here because the user finally gains control, so it looks cool to then type the location they're in
        UIManager.Instance.zoneText.DisplayText(RegionManager.Instance.GetPlayerCurrentZone().regionName, RegionManager.Instance.GetPlayerCurrentZone().isRestricted);

        // Cutscene for once they enter the hallway
        RegionManager.Instance.nurseRoomDoor.OnDoorClose += OnNurseRoomDoorClose;
    }