Abaci
Statistics with Context

Introduction

Exclusive context allow you to stop multiple contexts from being added at the same time to any bundle. Say you have running, jumping and crouching contexts added in code but don't have a suitable place to remove each context, you can just make them exclusive and let Abaci do that work for you. There is a More Context tutorial and Platformer example has a section on Exclusive Context if you want to see if in action.

Component

Exclusive context can be added as a component (or game object) and simply requires the contexts that you want to be exclusive filled out.

exclusive_context_component.png

Code

Exclusive contexts can also be added (and removed) in code through the Abaci.ExclusiveContext class.

ExclusiveContext playerStates = new ExclusiveContext();
playerStates.Register("walk", "run", "jump");
bundle.AddContext("walk");
Assert.AreEqual(bundle.IsContext("walk"), true);
Assert.AreEqual(bundle.IsContext("run"), false);
bundle.AddContext("run");
Assert.AreEqual(bundle.IsContext("walk"), false);
Assert.AreEqual(bundle.IsContext("run"), true);


API

The full API for the bundle is available Abaci.ExclusiveContext