Example #1
0
 public static void ClearBehaviors(this ICurio curio)
 {
     foreach (var behavior in curio.GetBehaviors())
     {
         behavior.Remove();
     }
 }
Example #2
0
 public static void RemoveBehaviors(this ICurio curio, Predicate <Behavior> predicate)
 {
     foreach (var behavior in curio.GetBehaviors())
     {
         if (predicate(behavior))
         {
             behavior.Remove();
         }
     }
 }
        bool PerformSpecialAction()
        {
            var world      = Curio.GetWorld();
            var orientable = Curio.GetBehavior <BehaviorOrientable>();
            var delta      = world.PlayerCurio.GetVisualTarget() - Curio.GetVisualTarget();
            var distance   = delta.Length();

            var attacks = Curio.GetBehaviors <IGruntAttack>().Shuffle(Random).OrderByDescending(x => x.Priority);

            foreach (var attack in attacks)
            {
                if (attack.CanUse())
                {
                    attack.Perform();
                    return(true);
                }
            }

            return(false);
        }
Example #4
0
 public static BehaviorActionHolder GetActionHolder(this ICurio curio, ActionSlot type)
 {
     return(curio.GetBehaviors <BehaviorActionHolder>().FirstOrDefault(x => x.Type == type));
 }
Example #5
0
 public static Vector2 GetOffset(this ICurio curio)
 {
     return(curio.GetBehaviors().OfType <IOffseted>().OrderBy(x => x.GetOffsetPriority()).Aggregate(Vector2.Zero, (x, y) => x + y.GetOffset()));
 }
Example #6
0
 public static ColorMatrix GetColor(this ICurio curio)
 {
     return(curio.GetBehaviors().OfType <IColored>().OrderBy(x => x.GetColorPriority()).Aggregate(ColorMatrix.Identity, (x, y) => x * y.GetColor()));
 }