public void RegisterPawnActions( Dispatcher dispatch, CombatantActions actions ) { DebugLogConsole.AddCommand( command: "Hurt", description: "Apply damage to a Combatant", method: (string id, int amount, Vector3 push) => { dispatch(actions.Hurt(pawnID: Guid.Parse(id), amount: amount, push: push)); } ); DebugLogConsole.AddCommand( command: "Heal", description: "Heal a Combatant", method: (string id, int amount) => { dispatch(actions.Heal(pawnID: Guid.Parse(id), amount: amount)); } ); DebugLogConsole.AddCommand( command: "Launch", description: "Launch a Combatant", method: (string id, Vector3 push) => { dispatch(actions.Launch(Guid.Parse(id), push)); } ); }
public void Construct( Dispatcher dispatch, CombatantActions actions, Guid pawnID ) { this.OnTriggerEnterAsObservable() .Select(other => other.GetComponent <HurtVolume>()) .Where(hurt => hurt != null) .Subscribe(hurt => { dispatch( actions.Hurt( pawnID, from: hurt.PawnID, amount: hurt.BaseDamage ) ); }); }