//------------------------------------------------------------------------------ // // 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 inputEntity { get { return GetGroup(CombatMatcher.Input).GetSingleEntity(); } } public CoreGame.Render.InputComponent input { get { return inputEntity.input; } } public bool hasInput { get { return inputEntity != null; } } public CombatEntity SetInput(int newDir) { if (hasInput) { throw new Entitas.EntitasException("Could not set Input!\n" + this + " already has an entity with CoreGame.Render.InputComponent!", "You should check if the context already has a inputEntity before setting it or use context.ReplaceInput()."); } var entity = CreateEntity(); entity.AddInput(newDir); return entity; } public void ReplaceInput(int newDir) { var entity = inputEntity; if (entity == null) { entity = SetInput(newDir); } else { entity.ReplaceInput(newDir); } } public void RemoveInput() { inputEntity.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.InputComponent input { get { return (CoreGame.Render.InputComponent)GetComponent(CombatComponentsLookup.Input); } } public bool hasInput { get { return HasComponent(CombatComponentsLookup.Input); } } public void AddInput(int newDir) { var index = CombatComponentsLookup.Input; var component = (CoreGame.Render.InputComponent)CreateComponent(index, typeof(CoreGame.Render.InputComponent)); component.dir = newDir; AddComponent(index, component); } public void ReplaceInput(int newDir) { var index = CombatComponentsLookup.Input; var component = (CoreGame.Render.InputComponent)CreateComponent(index, typeof(CoreGame.Render.InputComponent)); component.dir = newDir; ReplaceComponent(index, component); } public void RemoveInput() { RemoveComponent(CombatComponentsLookup.Input); } } //------------------------------------------------------------------------------ // // 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 _matcherInput; public static Entitas.IMatcher Input { get { if (_matcherInput == null) { var matcher = (Entitas.Matcher)Entitas.Matcher.AllOf(CombatComponentsLookup.Input); matcher.componentNames = CombatComponentsLookup.componentNames; _matcherInput = matcher; } return _matcherInput; } } }