-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlockAgent.cs
More file actions
31 lines (26 loc) · 754 Bytes
/
FlockAgent.cs
File metadata and controls
31 lines (26 loc) · 754 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Collider2D))]
public class FlockAgent : MonoBehaviour
{
Flock agentFlock;
public Flock AgentFlock { get { return agentFlock; } }
Collider2D _agentCollider;
public Collider2D AgentCollider { get { return _agentCollider; } }
// Start is called before the first frame update
void Start()
{
_agentCollider = GetComponent<Collider2D>();
}
public void Initialize(Flock flock)
{
agentFlock = flock;
}
// Update is called once per frame
public void Move(Vector2 velocity)
{
transform.up = velocity;
transform.position += (Vector3)velocity * Time.deltaTime;
}
}