You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.7 KiB
94 lines
3.7 KiB
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// 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.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
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();
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// 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.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
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);
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// 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.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
public sealed partial class CombatMatcher {
|
|
|
|
static Entitas.IMatcher<CombatEntity> _matcherInput;
|
|
|
|
public static Entitas.IMatcher<CombatEntity> Input {
|
|
get {
|
|
if (_matcherInput == null) {
|
|
var matcher = (Entitas.Matcher<CombatEntity>)Entitas.Matcher<CombatEntity>.AllOf(CombatComponentsLookup.Input);
|
|
matcher.componentNames = CombatComponentsLookup.componentNames;
|
|
_matcherInput = matcher;
|
|
}
|
|
|
|
return _matcherInput;
|
|
}
|
|
}
|
|
}
|
|
|