//------------------------------------------------------------------------------ // // This code was generated by Entitas.CodeGeneration.Plugins.ComponentContextApiGenerator. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ public partial class CombatContext { public CombatEntity cameraShakeEntity { get { return GetGroup(CombatMatcher.CameraShake).GetSingleEntity(); } } public CoreGame.Render.CameraShakeComponent cameraShake { get { return cameraShakeEntity.cameraShake; } } public bool hasCameraShake { get { return cameraShakeEntity != null; } } public CombatEntity SetCameraShake(float newDuration, string newPath) { if (hasCameraShake) { throw new Entitas.EntitasException("Could not set CameraShake!\n" + this + " already has an entity with CoreGame.Render.CameraShakeComponent!", "You should check if the context already has a cameraShakeEntity before setting it or use context.ReplaceCameraShake()."); } var entity = CreateEntity(); entity.AddCameraShake(newDuration, newPath); return entity; } public void ReplaceCameraShake(float newDuration, string newPath) { var entity = cameraShakeEntity; if (entity == null) { entity = SetCameraShake(newDuration, newPath); } else { entity.ReplaceCameraShake(newDuration, newPath); } } public void RemoveCameraShake() { cameraShakeEntity.Destroy(); } } //------------------------------------------------------------------------------ // // This code was generated by Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ public partial class CombatEntity { public CoreGame.Render.CameraShakeComponent cameraShake { get { return (CoreGame.Render.CameraShakeComponent)GetComponent(CombatComponentsLookup.CameraShake); } } public bool hasCameraShake { get { return HasComponent(CombatComponentsLookup.CameraShake); } } public void AddCameraShake(float newDuration, string newPath) { var index = CombatComponentsLookup.CameraShake; var component = (CoreGame.Render.CameraShakeComponent)CreateComponent(index, typeof(CoreGame.Render.CameraShakeComponent)); component.duration = newDuration; component.path = newPath; AddComponent(index, component); } public void ReplaceCameraShake(float newDuration, string newPath) { var index = CombatComponentsLookup.CameraShake; var component = (CoreGame.Render.CameraShakeComponent)CreateComponent(index, typeof(CoreGame.Render.CameraShakeComponent)); component.duration = newDuration; component.path = newPath; ReplaceComponent(index, component); } public void RemoveCameraShake() { RemoveComponent(CombatComponentsLookup.CameraShake); } } //------------------------------------------------------------------------------ // // This code was generated by Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ public sealed partial class CombatMatcher { static Entitas.IMatcher _matcherCameraShake; public static Entitas.IMatcher CameraShake { get { if (_matcherCameraShake == null) { var matcher = (Entitas.Matcher)Entitas.Matcher.AllOf(CombatComponentsLookup.CameraShake); matcher.componentNames = CombatComponentsLookup.componentNames; _matcherCameraShake = matcher; } return _matcherCameraShake; } } }