1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Brains.Framework.Utility;
namespace Brains.Framework
{
/// <summary>
/// Stores a direction and length of the feeler.
/// </summary>
public class Feeler
{
private Agent _owner;
/// <summary>
/// Gets the owning agent of the Feeler
/// </summary>
public Agent Owner { get { return _owner; } }
/// <summary>
/// Gets or Sets the direction of the Feeler in local space coordinates
/// </summary>
public Vector2 Vector { get; set; }
/// <summary>
/// Gets or sets the length of the Feeler
/// </summary>
public float Length { get; set; }
public Vector2 TipWorldPosition
{
get
{
Vector2 dest = VectorUtil.VectorToWorldSpace(Vector, Owner.Orientation);
Vector2 dd =Owner.Position + (dest * Length);
return dd;
}
}
/// <summary>
/// Gets the direction of the Feeler in world coordinates
/// </summary>
public Vector2 WorldDirection
{
get
{
Vector2 dest = VectorUtil.VectorToWorldSpace(Vector, Owner.Orientation);
return dest;
}
}
internal Feeler(Vector2 feeler,float length,Agent owner)
{
Length = length;
Vector = feeler;
_owner = owner;
}
}
} |