static Scene BuildScenes(GameManager gameManager) { Scene controlRoom = new StaticScene("Control Room", "The radio sits silently at the front. The grand window stares out into the darkness of space. To the south is the Lab."); ConcourseScene concourse = new ConcourseScene(); StadiumScene stadium = new StadiumScene(gameManager); DynamicScene storage = new DynamicScene("Storage", "Contains a rope hung by a hook from its wall. The Lab is to the east."); RopeItem ropeItem = new RopeItem(storage, concourse, stadium); LabScene lab = new LabScene("Lab", "Four capsules made of glass sit at the side.", "A lectern with buttons stands at the center. To the north is the Control Room.", ropeItem); Scene hall = new StaticScene("Hall", "East leads to the Concourse. South leads to the Lab."); concourse.SetDescription("A large room with multiple tables like a banquet hall. One wall scorched by the bright lights displays space across its massive window. The Hall is to the west."); #region Episodes #endregion #region Directions controlRoom.AddWork(new RoamWork(new string[] { RoamWork.South, "LAB" }, lab)); lab.AddWork(new RoamWork(new string[] { RoamWork.North, "CONTROL", "CONTROL ROOM" }, controlRoom)); lab.AddWork(new RoamWork(new string[] { RoamWork.East, "HALL" }, hall)); lab.AddWork(new RoamWork(new string[] { RoamWork.West, "STORAGE" }, storage)); storage.AddWork(new RoamWork(new string[] { RoamWork.East, "LAB" }, lab)); hall.AddWork(new RoamWork(new string[] { RoamWork.West, "LAB" }, lab)); hall.AddWork(new RoamWork(new string[] { RoamWork.East, "CONCOURSE" }, concourse)); concourse.AddWork(new RoamWork(new string[] { RoamWork.West, "HALL" }, hall)); // TEST //controlRoom.AddWork(new RoamWork(new string[] { "TEST" }, stadium)); #endregion #region Items controlRoom.AddItem(new RadioItem()); controlRoom.AddItem(new WindowItem { Description = "The window stares out into the vastness of space. The stars glitter in their reds, blues, and whites." }); { CapsuleItem capsuleItem = new CapsuleItem { Description = "Four empty capsules sit against the wall." }; WindowItem windowItem = new WindowItem { Description = "The stars from here are barely visible to the naked eye because of the sharp lights within the Concourse." }; lab.AddItem(capsuleItem); lab.AddItem(new LecternItem(lab, concourse, capsuleItem, windowItem)); concourse.AddItem(windowItem); } storage.AddItem(new HookItem()); storage.AddItem(ropeItem); #endregion return(controlRoom); }
void sceneStateChanged(DynamicScene s) { if (s.state == DynamicScene.SceneState.ENDED) { Destroy(s.gameObject); if (waitForEndBeforeStart) { currentScene = null; setScene(nextScenePrefab); } } }
private void glControl1_Load(object sender, EventArgs e) { // create a new dynamic scene and pass this control as the scene owner to hook control // then load the selected map into the scene Scene = new DynamicScene(_glControl1); // application idle will handle the render and update loop Application.Idle += HandleApplicationIdle; Scene.OnFrameReady += Scene_OnFrameReady; _glControl1.Resize += glControl1_Resize; // firing this method is meant to load the view-projection matrix values into // the shader uniforms, and initalizes the camera before the first draw can be called glControl1_Resize(this, new EventArgs( )); SceneInitialized?.Invoke(this, null); OpenGL.EnableDebugging(); }
void setScene(GameObject s) { if (currentScene == s) { return; } Debug.Log("[SceneManager] Set scene : " + s); if (currentScene != null) { currentScene.handleEndScene(); if (waitForEndBeforeStart) { nextScenePrefab = s; return; } } if (s != null) { currentScene = Instantiate(s).GetComponent <DynamicScene>(); currentScene.transform.SetParent(transform, false); if (currentScene != null) { currentScene.handleStartScene(); currentScene.sceneStateChanged += sceneStateChanged; } else { Debug.LogWarning("Loaded scene does not have a dynamicScene behavior in it !"); } nextScenePrefab = null; } }
public RopeItem(DynamicScene storageScene, Scene scene, Scene setScene) { useWork = new UseWork(this, scene, setScene); collectWork = new CollectWork(storageScene, this); examineWork = new ExamineWork(this); }
public CollectWork(DynamicScene storageScene, IItem item) : base(item) { Scene = storageScene; }
public static void ClearScene() { DynamicScene.ClearScene(); }
public static void RecoverySceneByConfig() { DynamicScene.RecoveryScene(); }
public static void WillAllSceneObjectWriteSceneFileByAssets() { DynamicScene.GenerateAllSceneFile(); }
public static void WillCurrentSceneObjectWriteSceneFileByAssets() { DynamicScene.GenerateSceneFile(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()); }
public Frame(SystemBase[] systems, RuntimeConfig runtimeConfig, SimulationConfig simulationConfig, FP deltaTime, Int32 simulationRate) { _systems = systems; _runtimeConfig = runtimeConfig; _simulationConfig = simulationConfig; _simulationRate = simulationRate; _frameEvents = new FrameEvents(this); _frameSignals = new FrameSignals(this); _destroy = new Queue <EntityRef>(1024); _entityManifoldFilter = _systems.FirstOrDefault(x => x is IEntityManifoldFilter) as IEntityManifoldFilter; // use dummy in case no system implements the filter if (_entityManifoldFilter == null) { _entityManifoldFilter = new DummyManifoldFilter(); } AllocGen(); InitGen(); _ISignalOnEntityCreateSystems = BuildSignalsArray <ISignalOnEntityCreated>(); _ISignalOnEntityDestroySystems = BuildSignalsArray <ISignalOnEntityDestroy>(); _ISignalOnCollisionStaticSystems = BuildSignalsArray <ISignalOnCollisionStatic>(); _ISignalOnCollisionDynamicSystems = BuildSignalsArray <ISignalOnCollisionDynamic>(); _ISignalOnTriggerStaticSystems = BuildSignalsArray <ISignalOnTriggerStatic>(); _ISignalOnTriggerDynamicSystems = BuildSignalsArray <ISignalOnTriggerDynamic>(); _ISignalOnNavMeshTargetReachedSystems = BuildSignalsArray <ISignalOnNavMeshTargetReached>(); // assign map, rng session, etc. _globals->Map.Asset = runtimeConfig.Map.Instance; _globals->RngSession = new RNGSession(runtimeConfig.Seed); _globals->DeltaTime = deltaTime; // set default enabled systems for (Int32 i = 0; i < _systems.Length; ++i) { if (_systems[i].StartEnabled) { BitSet256.Set(&_globals->Systems, i); } } var allEntities = GetAllEntitiesUnsafe(); // init physics var physicsEntities = new List <DynamicScene.DynamicSceneEntity>(); for (Int32 i = 0; i < allEntities.Length; ++i) { var e = allEntities[i]; var d = Entity.GetDynamicBody(e.Entity); var t = Entity.GetTransform2D(e.Entity); var tv = Entity.GetTransform2DVertical(e.Entity); if (tv == null) { tv = &_globals->PhysicsSettings.DefaultVerticalTransform; } if (d != null) { physicsEntities.Add(new DynamicScene.DynamicSceneEntity { Entity = (void *)e.Entity, DynamicBody = d, Transform2D = t, Transform2DVertical = tv, }); } } // init physics _globals->PhysicsSettings.Gravity = simulationConfig.Physics.Gravity; _globals->PhysicsSettings.SolverIterations = simulationConfig.Physics.SolverIterations; _globals->PhysicsSettings.UseAngularVelocity = simulationConfig.Physics.UseAngularVelocity; _globals->PhysicsSettings.Substeps = simulationConfig.Physics.Substeps; _globals->PhysicsSettings.RaiseCollisionEventsForStatics = simulationConfig.Physics.RaiseCollisionEventsForStatics; // create scene _scene = new DynamicScene(&_globals->PhysicsSettings, physicsEntities.ToArray()); // init animator var animatorEntities = new List <AnimatorUpdater.AnimatorEntity>(); for (Int32 i = 0; i < allEntities.Length; ++i) { var e = allEntities[i]; var a = Entity.GetAnimator(e.Entity); if (a != null) { animatorEntities.Add(new AnimatorUpdater.AnimatorEntity { Entity = (void *)e.Entity, Animator = a, Transform = Entity.GetTransform2D(e.Entity), DynamicBody = Entity.GetDynamicBody(e.Entity) }); } } _animator = new AnimatorUpdater(animatorEntities.ToArray()); // init animator var navMeshEntites = new List <NavMeshUpdater.NavMeshEntity>(); for (Int32 i = 0; i < allEntities.Length; ++i) { var e = allEntities[i]; var a = Entity.GetNavMeshAgent(e.Entity); if (a != null) { navMeshEntites.Add(new NavMeshUpdater.NavMeshEntity { Entity = (void *)e.Entity, Agent = a, Transform2D = Entity.GetTransform2D(e.Entity), DynamicBody = Entity.GetDynamicBody(e.Entity), Index = i }); } } NavMeshUpdater.NavMeshUpdaterConfig navMeshConfig = new NavMeshUpdater.NavMeshUpdaterConfig() { ProximityFactor = simulationConfig.NavMeshAgent.ProximityFactor, UpdateInterval = simulationConfig.NavMeshAgent.UpdateInterval }; _navMeshUpdater = new NavMeshUpdater(navMeshEntites.ToArray(), Scene, Map, navMeshConfig); AllocUser(); InitUser(); }