This repository has been archived by the owner on Mar 18, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZackKamakazi.cs
61 lines (57 loc) · 1.66 KB
/
ZackKamakazi.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
using System;
using SevenEngine.Mathematics;
using SevenEngine.DataStructures;
using SevenEngine.StaticModels;
namespace Game.Units
{
public class ZackKamakazi : Kamakazi
{
Unit _target;
public ZackKamakazi(string id, StaticModel staticModel) : base(id, staticModel) { }
public override void AI(float elapsedTime, OctreeLinked<Unit, string> octree)
{/*
if (IsDead == false)
{
// Targeting
if (_target == null || _target.IsDead)
{
float longest = float.MinValue;
octree.Traverse
(
(Unit current) =>
{
if ((current is KillemKamakazi || current is KillemMelee || current is KillemRanged) && !current.IsDead)
{
float length = (current.Position - Position).Length;
if (_target == null || _target.IsDead)
{
_target = current;
longest = length;
}
else if (length > longest)
{
_target = current;
longest = length;
}
}
}
);
}
// Attacking
else if (Foundations.Abs((Position - _target.Position).Length) < _attackRange / 2)
{
Attack(octree);
}
// Moving
else
{
Vector direction = _target.Position - Position;
Position.X += (direction.X / direction.Length) * MoveSpeed;
Position.Y += (direction.Y / direction.Length) * MoveSpeed;
Position.Z += (direction.Z / direction.Length) * MoveSpeed;
}
<<<<<<< HEAD
}*/
}
}
}