-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMouse.cs
43 lines (40 loc) · 1.45 KB
/
Mouse.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
using System;
using System.Collections.Generic;
namespace ZooManager
{
class Mouse : Animal, IPrey
{
public Mouse(string name) : base(name)
{
//emoji for show the animal on the cells
emoji = "🐭";
//didn't use at the moment
species = "mouse";
//"this" means this class, to seperate the arg of name
//name will set in Interaction.AddAnimalToHolding
//Animal (parent) has set the name
//this.name = name;
//reaction time is 1 (>=1) to 3 (<4)
reactionTime = new Random().Next(1, 4);
}
/*
* active an animal, flee from raptor, cat (output name and location was written on parent)
* call: no
* called by: no
* parameter: no
* return: no (void)
*/
//override the Activate() in Animal
public override void Activate()
{
//base is Animal, base on Activate in Occupant (parent)
base.Activate();
Console.WriteLine("I am a mouse. Squeak.");
//if found "raptor" or "cat" near it (distance 1) run away with distance 2
//feature g
Flee(new string[] { "raptor", "cat" }, 2);
}
//there is Flee method with paremeters that in Occupant class and it is better than using the Flee from interface
void IPrey._Flee(string[] targets, int distance) { }
}
}