-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOtherCritter.cs
65 lines (56 loc) · 1.46 KB
/
OtherCritter.cs
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
65
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// Forms a wrapper around the IOtherCritter interface to ensure that brains can only call the methods
// we want them to call.
namespace CritterBrains
{
public class OtherCritter
{
IOtherCritter _otherCritter;
ICritter _me;
public OtherCritter(IOtherCritter otherCritter, ICritter me)
{
_otherCritter = otherCritter;
_me = me;
}
/// <summary>
/// Returns the strength of the other critter
/// </summary>
public Strength Strength
{
get
{
return _me.GetStrengthOf(_otherCritter);
}
}
/// <summary>
/// Attack the other critter
/// </summary>
public void Attack()
{
_me.Attack(_otherCritter);
}
/// <summary>
/// Return the direction to the other critter
/// </summary>
public int DirectionTo
{
get
{
return _me.GetDirectionTo(_otherCritter);
}
}
/// <summary>
/// Is terrain blocking the direct route to the other critter?
/// </summary>
public bool IsTerrainBlockingRouteTo
{
get
{
return _me.IsTerrainBlockingRouteTo((IWorldObject)_otherCritter);
}
}
}
}