/// <summary> /// Add attractors in order from closest to furthest /// include distance from bot, /// vector effect, /// and radius that the effect starts to fade /// </summary> /// <param name="distance"></param> /// <param name="value"></param> /// <param name="unitRadius"></param> public void AddAttractor(Attractor eff, float unitRadius = 0) { Debug.Assert(!eff.Used); // make it distance from edge not center eff.Distance -= unitRadius; Actions.Add(eff); }
} // end of Free() /// <summary> /// Old-style action. Should be replaced? TargetDirectionAction? /// /// We still use this for stuff like shooting. /// /// WHEN See Apple DO Shoot /// gameThing is the nearest apple /// direction is the direction to shoot /// distance is distance to apple /// /// WHEN GamePad AButton DO Shoot /// gameThing is null /// direction is forward /// distance is 1 /// /// </summary> /// <param name="distance"></param> /// <param name="direction"></param> /// <param name="gameThing"></param> /// <param name="reflex"></param> /// <param name="canBlend"></param> /// <param name="specialInstruction"></param> /// <returns></returns> static public Attractor AllocAttractor(float distance, Vector3 direction, GameThing gameThing, Reflex reflex, bool canBlend = false, BaseAction.SpecialInstruction specialInstruction = BaseAction.SpecialInstruction.None) { Attractor attractor; // Recycle an attractor if possible. If not, create a new one. if (AttractorFreeList.Count > 0) { attractor = AttractorFreeList[AttractorFreeList.Count - 1]; AttractorFreeList.RemoveAt(AttractorFreeList.Count - 1); } else { attractor = new Attractor(); } // Fill in the data. attractor.Init(distance, direction, gameThing, reflex, canBlend, specialInstruction); return(attractor); } // end of AllocAttractor()