-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlien.cs
More file actions
49 lines (47 loc) · 1.72 KB
/
Alien.cs
File metadata and controls
49 lines (47 loc) · 1.72 KB
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
using System;
using System.Collections.Generic;
namespace ZooManager
{
class Alien : Occupant, IPredator
{
public Alien(string name)
{
//emoji for show on the cells
emoji = "👽";
//didn't use at the moment
species = "alien";
//"this" means this class, to seperate the arg of name
//name will set in Interaction.AddAnimalToHolding
this.name = name;
//reaction time is 1
reactionTime = 10;
}
/*
* active an animal, hunt mouse or 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 Occupant
base.Activate();
Console.WriteLine("I am an alien.");
//make alien attack all things, includes alien
//a list for name of occupant from occupants, occupantsName length is the same as Game.occupants
string[] occupantsName = new string[Game.occupants.Length];
//add the name string to occupantsName
for (int i=0; i<Game.occupants.Length; i++)
{
occupantsName[i] = Game.occupants[i].name;
}
//hunt all things in the Game.occupants list if distance is 1
//the function only hunt when it can hunt
Hunt(occupantsName, 1);
}
//there is Hunt method with paremeters that in Occupant class and it is better than using the Hunt from interface
void IPredator._Hunt(string[] targets, int distance) { }
}
}