public void Revert(Level level, IChange change) { if (change is DestroyedChange) { DestroyedFx?.Stop(); RevertDestroyedFx?.Trigger(transform); if (Animator != null) { Animator.SetBool(AnimDiedBool, false); } if (DisableAllRenderersWhenInactive) { foreach (var rnd in gameObject.GetComponentsInChildren <Renderer>()) { rnd.enabled = true; } } if (DisableRenderersWhenInactive != null) { foreach (var rnd in DisableRenderersWhenInactive) { rnd.enabled = true; } } SoundManager.Instance.Play(RevertDestroySound); _entity.Activate(); } }
public Entity CreateEmptyEntity() { int why; if (_uids.Keys.Count > 0) { why = Enumerable.Range(1, _uids.Keys.Max() + 2).Except(_uids.Keys).First(); } else { why = 1; } Entity entity = new Entity(this, why); _uids.Add(why, entity); _entities.Add(entity); entity.HierarchyNode.Parent = HierarchyRoot; if (Running) { entity.Activate(); } entity.OnComponentAdded += Entity_OnComponentAdded; entity.OnComponentRemoved += Entity_OnComponentRemoved; Log.Core.Trace($"created entity with uid {entity.UID}"); return(entity); }
bool ActivateEntity(object[] Params) { Entity Target = (Entity)Params[0]; if (Target == null || !Target.Exists) { return(true); } if (Target.Distance > 2500) { Clear(); ApproachTarget = Target; ApproachDistance = 2500; QueueState(ApproachState); QueueState(ActivateEntity, -1, Target); return(false); } Log.Log("|oActivating"); Log.Log(" |-g{0}", Target.Name); Target.Activate(); WaitFor(30, () => MyShip.ToEntity.Mode == EntityMode.Warping); return(true); }
public void Update_IgnoresNonUpdateComponents() { var entity = new Entity(1); var component1 = new ComponentStub(entity); entity.AddComponent(component1); var component2 = new UpdateComponentStub(entity); entity.AddComponent(component2); entity.Initialize(); entity.Activate(); var time = 1.0f; entity.Update(time); Assert.AreEqual(0, component1.UpdateCallCount); Assert.AreEqual(1, component2.UpdateCallCount); Assert.AreEqual(time, component2.LastUpdateDeltaTime); }
public void DoActivate_ActivatesComponents() { var entity = new Entity(1); var component1 = new ComponentStub(entity); entity.AddComponent(component1); var component2 = new UpdateComponentStub(entity); entity.AddComponent(component2); entity.Initialize(); entity.Activate(); Assert.IsTrue(entity.IsActive); Assert.IsTrue(component1.IsActive); Assert.AreEqual(1, component1.DoActivateCallCount); Assert.IsTrue(component2.IsActive); Assert.AreEqual(1, component2.DoActivateCallCount); }
public void Revert(Level level, IChange change) { if (change is Collection) { SoundManager.Instance.Play(RevertPickupSound); _collectFx.Stop(); _revertCollectFx.Trigger(transform); _haloFx.Trigger(transform); if (_disableRenderersWhenInactive != null) { foreach (var rnd in _disableRenderersWhenInactive) { rnd.enabled = true; } } _entity.Activate(); level.LoseStar(); } }
// Uncomment the method below to handle the event raised after a feature has been activated. public override void FeatureActivated(SPFeatureReceiverProperties properties) { // Get the Catalog for the SharePoint site BdcService service = SPFarm.Local.Services.GetValue <BdcService>(String.Empty); SPSite site = new SPSite("http://sp2016:2016/"); SPServiceContext context = SPServiceContext.GetContext(site); AdministrationMetadataCatalog catalog = service.GetAdministrationMetadataCatalog(context); catalog.GetModels("EmployeeModel")?.ToList().ForEach(m => m.Delete()); // Create a new Employee Model // NOTE: Assume that the "EmployeeModel" Model // does not already exist. Model EmployeeModel = Model.Create("EmployeeModel", true, catalog); // Make a new Employee LobSystem // NOTE: Assume that the "AdventureWorks" LobSystem // does not already exist. LobSystem adventureWorksLobSystem = EmployeeModel.OwnedReferencedLobSystems.Create("AdventureWorks", true, SystemType.Database); // Make a new AdventureWorks LobSystemInstance. LobSystemInstance adventureWorksLobSystemInstance = adventureWorksLobSystem.LobSystemInstances.Create("AdventureWorks", true); // Set the connection properties. adventureWorksLobSystemInstance.Properties.Add( "ShowInSearchUI", ""); adventureWorksLobSystemInstance.Properties.Add( "DatabaseAccessProvider", "SqlServer"); adventureWorksLobSystemInstance.Properties.Add( "RdbConnection Data Source", "SP2016"); adventureWorksLobSystemInstance.Properties.Add( "RdbConnection Initial Catalog", "AdventureWorks2016"); adventureWorksLobSystemInstance.Properties.Add( "AuthenticationMode", "RdbCredentials"); adventureWorksLobSystemInstance.Properties.Add( "SsoProviderImplementation", "Microsoft.Office.SecureStoreService.Server.SecureStoreProvider, Microsoft.Office.SecureStoreService, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"); adventureWorksLobSystemInstance.Properties.Add( "SsoApplicationId", "Adventure"); adventureWorksLobSystemInstance.Properties.Add( "RdbConnection Pooling", "true"); // Create a new Employee Entity. Entity EmployeeEntity = Entity.Create( "Employee", "AdventureWorks", true, new Version("1.0.0.4"), 10000, CacheUsage.Default, adventureWorksLobSystem, EmployeeModel, catalog); // Set the identifier to the EmployeeID column. EmployeeEntity.Identifiers.Create( "BusinessEntityID", true, "System.Int32"); // Create the Finder Method, // i.e. the method to return all rows. CreateReadListMethod(catalog, EmployeeEntity); // Create the Specific Finder Method, // i.e. the method to return one row. CreateReadItemMethod(catalog, EmployeeEntity); // Validate the Employee Entity. ActivationError[] activationErrors = EmployeeEntity.Validate(); // Check if the validation failed. if (activationErrors.Count() == 0) { // The validation was successful so publish the Employee Entity. EmployeeEntity.Activate(); } }
void DoSpawn(Vector3 P, Vector3 dir) { Vector3 vector; if (this._spawnOnFloor && PhysicsUtility.GetFloorPoint(P, 20f, 50f, this._floorLayer, out vector)) { P.y = vector.y; } Vector3 vector2 = P + this._playerEnt.transform.localPosition; GameObject gameObject = Object.Instantiate <GameObject>(this._playerCamera, vector2 + this._playerCamera.transform.localPosition, this._playerCamera.transform.localRotation); gameObject.transform.localScale = this._playerCamera.transform.localScale; gameObject.name = this._playerCamera.name; CameraContainer component = gameObject.GetComponent <CameraContainer>(); component.Init(this._playerCamera); Entity entity = Object.Instantiate <Entity>(this._playerEnt, vector2, base.transform.rotation); entity.name = this._playerEnt.name; if (component != null) { RoomSwitchable componentInChildren = entity.GetComponentInChildren <RoomSwitchable>(); if (componentInChildren != null) { componentInChildren.SetLevelCamera(component); } } if (this._playerGraphics != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this._playerGraphics, entity.transform.position + this._playerGraphics.transform.localPosition, this._playerGraphics.transform.localRotation); gameObject2.transform.parent = entity.transform; gameObject2.transform.localScale = this._playerGraphics.transform.localScale; gameObject2.name = this._playerGraphics.name; } entity.Init(); entity.TurnTo(dir, 0f); FollowTransform componentInChildren2 = gameObject.GetComponentInChildren <FollowTransform>(); if (componentInChildren2 != null) { componentInChildren2.SetTarget(entity.transform); } LevelCamera componentInChildren3 = gameObject.GetComponentInChildren <LevelCamera>(); if (componentInChildren3 != null) { LevelRoom roomForPosition = LevelRoom.GetRoomForPosition(entity.WorldTracePosition, null); if (roomForPosition != null) { componentInChildren3.SetRoom(roomForPosition); roomForPosition.SetImportantPoint(vector2); LevelRoom.SetCurrentActiveRoom(roomForPosition, false); } } PlayerController controller = ControllerFactory.Instance.GetController <PlayerController>(this._controller); controller.ControlEntity(entity); controller.name = this._controller.name; entity.Activate(); if (this._varOverrider != null) { this._varOverrider.Apply(entity); } EntityHUD componentInChildren4 = gameObject.GetComponentInChildren <EntityHUD>(); if (componentInChildren4 != null) { componentInChildren4.Observe(entity, controller); } EntityObjectAttacher.Attacher attacher = null; EntityObjectAttacher component2 = base.GetComponent <EntityObjectAttacher>(); if (component2 != null) { attacher = component2.GetAttacher(); } EntityObjectAttacher.AttachTag attachTag = null; if (attacher != null) { attachTag = attacher.Attach(entity); } PlayerRespawner playerRespawner; if (this._respawner != null) { playerRespawner = Object.Instantiate <PlayerRespawner>(this._respawner); playerRespawner.name = this._respawner.name; } else { GameObject gameObject3 = new GameObject("PlayerRespawer"); playerRespawner = gameObject3.AddComponent <PlayerRespawner>(); } playerRespawner.Init(entity, controller, componentInChildren3, componentInChildren2, componentInChildren4, this._gameSaver, attacher, attachTag, this._varOverrider, P, dir); VarHelper.PlayerObj = entity.gameObject; // Store reference to player obj PlayerSpawner.OnSpawnedFunc onSpawnedFunc = PlayerSpawner.onSpawned; PlayerSpawner.onSpawned = null; if (onSpawnedFunc != null) { onSpawnedFunc(entity, gameObject, controller); } EventListener.PlayerSpawn(false); // Invoke custom event Object.Destroy(base.gameObject); }
public override void Activate() { _entity.Activate(); }