-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGiantKillerRobot.cs
More file actions
49 lines (38 loc) · 1.24 KB
/
GiantKillerRobot.cs
File metadata and controls
49 lines (38 loc) · 1.24 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;
using System.Linq;
namespace OOP_Proiecte
{
internal class GiantKillerRobot
{
public string Name { get; set; }
public int EyeLaserIntensity { get; set; } = 0;
public List<CreatureType> Target { get; set; } = new List<CreatureType>();
public bool Active { get; set; }
public Creature CurentTarget { get; set; }
public Planet Planet { get; set; } = new Planet();
public void initialize()
{
Name = "Baymax";
Active = true;
Target = new List<CreatureType>();
EyeLaserIntensity = 10;
AcquireNextTarget();
}
public void FireLaserAt(Creature curentTarget)
{
bool isAtarget = Target.Any((target) => target == curentTarget.Type);
if (isAtarget)
{
curentTarget.LaserShoot(EyeLaserIntensity);
}
}
public void AcquireNextTarget()
{
Random rnd = new Random();
int creatureNumber = Planet.Creatures.Count;
int creatureSelection = rnd.Next(creatureNumber);
CurentTarget = Planet.Creatures[creatureSelection];
}
}
}