-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerEventTracker
More file actions
114 lines (85 loc) · 2.86 KB
/
Copy pathPlayerEventTracker
File metadata and controls
114 lines (85 loc) · 2.86 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerEventTracker : MonoBehaviour
{
//Game Objects in scene to track
private GameObject player;
private GameObject cam;
private CameraMovement camCont;
private PlayerController playerCont;
private float playerX;
private float playerY;
// Start is called before the first frame update
void Start()
{
//set the gameobjects
player = GameObject.FindGameObjectWithTag("Player");
cam = GameObject.FindGameObjectWithTag("MainCamera");
camCont = cam.GetComponent<CameraMovement>();
playerCont = player.GetComponent<PlayerController>();
}
// Update is called once per frame
void Update()
{
//get the player's position
playerX = player.transform.position.x;
playerY = player.transform.position.y;
//check if the player has fallen into Beacon
if(playerY > -10 && playerY < 20)
{
playerCont.spawnX = 78;
playerCont.spawnY = -46;
}
//check if player is in the building
if(playerX >= 152 && playerX <= 191)
{
camCont.yOffset = 0;
playerCont.spawnX = 155;
playerCont.spawnY = -50;
}
//check if player is in the building extension
if(playerY < -49 && playerX > 191)
{
}
//check if player has exited the building
if(playerX < 152 && playerX >= 110 && playerY < -60 && playerY > -77)
{
camCont.yOffset = 2;
playerCont.spawnX = 150;
playerCont.spawnY = -76;
}
//check if player is in downward stretch of underground
if(playerX > 86 && playerX < 119 && playerY < -57)
{
camCont.yOffset = -2;
playerCont.spawnX = 112;
playerCont.spawnY = -84;
}
//check if player is in upwards stretch of underground
if(playerX < 86 && playerX >= 53 && playerY < -50)
{
camCont.yOffset = 1;
playerCont.spawnX = 61.3f;
playerCont.spawnY = -142;
}
//check if player is in the beacon area
if(playerX < 53 && playerY < -33)
{
camCont.yOffset = 1.5f;
playerCont.spawnX = 40;
playerCont.spawnY = -73;
}
//check if player has gone into the Beacon
if(playerX > 16 && playerX < 23 && playerY < -95)
{
player.transform.position = new Vector3(250, 108, 0);
playerCont.inGuardFight = true;
playerCont.spawnX = 230;
playerCont.spawnY = 93;
camCont.canFollow = false;
cam.transform.position = new Vector3(250, 100, -15);
playerCont.StartGuardFight();
}
}
}