blob: 1a05521d1c7f720826f5ed1fb9cd9dc49c34bc75 (
plain)
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
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Boss1MovementSCript : MonoBehaviour {
float counter;
float timer = 5f;
List<Vector3> positions;
int i = 2;
bool active;
void Start ()
{
positions = new List<Vector3> { new Vector3(120, 12), new Vector3(150, 12), new Vector3(135, 2.5f) };
}
void Update ()
{
if (active)
{
counter += Time.deltaTime;
if (counter >= timer)
{
counter = 0f;
gameObject.transform.position = positions[i];
i = ++i % 3;
}
}
}
public void EnableBoss1Movement()
{
active = true;
}
public void DisableBoss1Movement()
{
active = false;
}
}
|