Example #1
0
        /// <summary> Wanders around a target location without waiting between new wanders</summary>
        public void Search(Vector2 target, Chunk chunk, float time, bool cursory = false)
        {
            Path           = null;
            StateTimer     = time;
            TargetLocation = target;
            WanderLocation = target;

            for (int i = 0; i < 5; ++i)
            {
                float offset = (float)((-0.15F + Game.RNG.NextDouble() * 0.3F) * Math.PI);
                var   dir    = new Vector2((float)Math.Cos(Direction + offset), (float)Math.Sin(Direction + offset));
                if (QueryWander(TargetLocation, dir, SearchRange, chunk))
                {
                    TargetLocation = WanderLocation;
                    break;
                }
            }


            State = cursory? AIState.CursorySearching : AIState.Searching;
            ViewCone.SetColor(cursory ? ConeEntity.InspectColor : ConeEntity.AlertColor);
        }
Example #2
0
 public void Alert(Vector2 Position, Chunk chunk)
 {
     ViewCone.SetColor(ConeEntity.AlertColor);
 }