private int triggerCount; // the count that needs to be reached before triggering #endregion Fields #region Constructors public TriggerCollision(AIState _state, CollisionCounter c, int count, bool lt) : base(_state) { this.cCounter = c; this.triggerCount = count; this.LessThan = lt; }
//board constructor public CollisionCounter(CollisionCounter c, Vector2 pos) { this.Box = new Hitbox(c.Box, pos); this.SetPosition(pos); this.CollisionSetting = c.CollisionSetting; CollisionEffects = new Dictionary<int, Effect>(); }
public void InitializeAIHoming() { AIState move = new AIState(true, false); AIState home = new AIState(true, true); CollisionCounter c = new CollisionCounter(40, 3, Device); var t1 = new TriggerCollision(home, c, 0, false); move.AddTrigger(t1); AIHoming = new AI(move); }
/* AI For enemy actors. When a friendly (player) * actor comes close, the actor will stop moving. */ public void InitializeAICloseStop() { AIState move = new AIState(true, false); AIState stop = new AIState(false, false); CollisionCounter c = new CollisionCounter(30, 3, Device);//radius of 15, collides with Friendly Actors var t1 = new TriggerCollision(stop, c, 0, false); // trips when more than 1 friendly actor in radius var t2 = new TriggerCollision(move, c, 1, true); // trips when there are no friendly actors in radius move.AddTrigger(t1); stop.AddTrigger(t2); AICloseStop = new AI(move); }