-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPositionQueue.cs
More file actions
38 lines (33 loc) · 765 Bytes
/
PositionQueue.cs
File metadata and controls
38 lines (33 loc) · 765 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace RegionFlags
{
class PositionQueue
{
private Queue<Vector2> positions;
public PositionQueue()
{
positions = new Queue<Vector2>();
}
public void enqueue( Vector2 pos )
{
positions.Enqueue(pos);
if (positions.Count > 3)
positions.Dequeue();
}
public void reset( Vector2 pos )
{
positions.Clear();
positions.Enqueue(pos);
}
public Vector2 getTP()
{
Vector2 pos = positions.Peek();
reset(pos);
return pos;
}
}
}