示例#1
0
 public DoorActor GetRoomDoorTriggerFromDoorData(DoorData Door)
 {
     foreach (DoorActor DoorActor in DoorTriggers)
     {
         if (DoorActor.GetAssociatedDoorData() == Door)
         {
             return(DoorActor);
         }
     }
     return(null);
 }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Door"></param>
 public void AddDoorActor(DoorActor Door)
 {
     if (Door == null)
     {
         Debug.LogWarning("A null door actor was passedin into our RoomActor...");
         return;
     }
     if (!DoorTriggers.Add(Door))
     {
         Debug.LogWarning("This doo was already added to our room actor container");
     }
 }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Door"></param>
 public void RemoveDoorActor(DoorActor Door)
 {
     if (Door == null)
     {
         Debug.LogWarning("A null door actor was passed into our RoomActor...");
         return;
     }
     if (!DoorTriggers.Remove(Door))
     {
         Debug.LogWarning("The door that was passed in was not found in our room actor container");
     }
 }
示例#4
0
        public List <Actor> ReadDoorActors(FileReader reader, GameVersion version, int numActors)
        {
            List <Actor> actors = new List <Actor>();

            for (int i = 0; i < numActors; i++)
            {
                DoorActor actor = new DoorActor();
                actor.RoomFront             = reader.ReadByte();
                actor.TransitionEffectFront = reader.ReadByte();
                actor.RoomBack             = reader.ReadByte();
                actor.TransitionEffectBack = reader.ReadByte();
                actor.ActorID   = reader.ReadUInt16();
                actor.PositionX = reader.ReadUInt16();
                actor.PositionY = reader.ReadUInt16();
                actor.PositionZ = reader.ReadUInt16();
                actor.RotationY = reader.ReadUInt16();
                actor.Variable  = reader.ReadUInt16();
                actors.Add(actor);
            }
            return(actors);
        }
示例#5
0
    /// <summary>
    /// Coroutine that carries our our scene transition
    /// </summary>
    /// <param name="PlayerCharacter"></param>
    /// <param name="DoorToLoad"></param>
    /// <returns></returns>
    private IEnumerator SceneTransitionCoroutine(EHPlayerCharacter PlayerCharacter, DoorData DoorToLoad)
    {
        if (!PlayerCharacter)
        {
            Debug.LogWarning("The player that was passed in was null");
            yield break;
        }
        if (!DoorToLoad)
        {
            Debug.LogWarning("The Door to load was null");
            yield break;
        }
        bIsExecutingSceneTransition = true;
        Image_BlackScreen.color     = Color.clear;
        Image_BlackScreen.gameObject.SetActive(true);

        PlayerCharacter.GetComponent <EHPlayerController>().enabled = false;
        float TimeThatHasPassed = 0;

        while (TimeThatHasPassed < TransitionTimeSeconds)
        {
            yield return(null);

            TimeThatHasPassed      += EHTime.RealDeltaTime;
            Image_BlackScreen.color = new Color(0, 0, 0, TimeThatHasPassed / TransitionTimeSeconds);
        }
        Image_BlackScreen.color = Color.black;

        RoomActor CurrentlyLoadedRoom = BaseGameOverseer.Instance.CurrentlyLoadedRoom;

        if (CurrentlyLoadedRoom.GetAssociatedRoomData() != DoorToLoad.GetDoorRoom())
        {
            if (CurrentlyLoadedRoom && CurrentlyLoadedRoom.GetAssociatedRoomData())
            {
                print(CurrentlyLoadedRoom.GetAssociatedRoomData().RoomScene);
                yield return(SceneManager.UnloadSceneAsync(CurrentlyLoadedRoom.GetAssociatedRoomData().RoomScene));
            }
            yield return(SceneManager.LoadSceneAsync(DoorToLoad.GetDoorRoom().RoomScene, LoadSceneMode.Additive));
        }
        yield return(new WaitForSecondsRealtime(0.5f));

        DoorActor DoorToSpawnFrom        = BaseGameOverseer.Instance.CurrentlyLoadedRoom.GetRoomDoorTriggerFromDoorData(DoorToLoad);
        Vector3   CharacterSpawnPosition = Vector3.zero;

        if (DoorToSpawnFrom == null)
        {
            Debug.LogError("There was no associated door actor to spawn our character");
        }
        else
        {
            CharacterSpawnPosition = DoorToSpawnFrom.GetSpawnPosition();
        }

        PlayerCharacter.SetCharacterAtPosition(CharacterSpawnPosition);
        EHPhysics2D Physics2D = PlayerCharacter.GetComponent <EHPhysics2D>();

        if (Physics2D)
        {
            Physics2D.Velocity = Vector2.zero;
        }
        BaseGameOverseer.Instance.MainGameCamera.FocusCameraImmediate();
        PlayerCharacter.GetComponent <EHPlayerController>().enabled = true;
        TimeThatHasPassed           = 0;
        bIsExecutingSceneTransition = false;
        while (TimeThatHasPassed < TransitionTimeSeconds && !bIsExecutingSceneTransition)
        {
            yield return(null);

            TimeThatHasPassed      += EHTime.RealDeltaTime;
            Image_BlackScreen.color = new Color(0, 0, 0, 1 - (TimeThatHasPassed / TransitionTimeSeconds));
        }

        Image_BlackScreen.color = Color.clear;
    }