Improved script allowing to move tombstones
This commit is contained in:
parent
032689eeca
commit
6c380faeab
@ -23,13 +23,45 @@ public class MoveTombstone : MonoBehaviour
|
|||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
speed = 100f;
|
||||||
x = transform.position.x;
|
x = transform.position.x;
|
||||||
y = transform.position.y;
|
y = transform.position.y;
|
||||||
|
position = PlayerPrefs.GetString(tombstone);
|
||||||
|
if(position == "top")
|
||||||
|
{
|
||||||
|
temp.x = x;
|
||||||
|
temp.y = y + 1;
|
||||||
|
goal = "set";
|
||||||
|
pos = "top";
|
||||||
|
}
|
||||||
|
else if (position == "bottom")
|
||||||
|
{
|
||||||
|
temp.x = x;
|
||||||
|
temp.y = y - 1;
|
||||||
|
goal = "set";
|
||||||
|
pos = "bottom";
|
||||||
|
}
|
||||||
|
else if (position == "right")
|
||||||
|
{
|
||||||
|
temp.x = x + 1;
|
||||||
|
temp.y = y;
|
||||||
|
goal = "set";
|
||||||
|
pos = "right";
|
||||||
|
}
|
||||||
|
else if (position == "left")
|
||||||
|
{
|
||||||
|
temp.y = y;
|
||||||
|
temp.x = x - 1;
|
||||||
|
goal = "set";
|
||||||
|
pos = "left";
|
||||||
|
}
|
||||||
|
|
||||||
if (x == transform.position.x && y == transform.position.y)
|
if (x == transform.position.x && y == transform.position.y)
|
||||||
{
|
{
|
||||||
PlayerPrefs.SetString(tombstone, "start");
|
PlayerPrefs.SetString(tombstone, "start");
|
||||||
}
|
}
|
||||||
player = GameObject.FindWithTag("Player");
|
player = GameObject.FindWithTag("Player");
|
||||||
|
speed = 3f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user