30 lines
1020 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Assets.Scripts
{
public class ExploreQuest : Quest
{
public ExploreQuest(GameObject display) : base(display)
{
Vector3 playerPos = GameObject.Find("Player").GetComponent<Player>().transform.position;
float coordX = getRandomNumber(1000) - 500;
float coordZ = getRandomNumber(1000) - 500;
coordinates = new Vector3(playerPos.x + coordX, 0, playerPos.z + coordZ);
questname = "Travel to " + Mathf.Floor(coordinates.x) + "/" + Mathf.Floor(coordinates.z) + "(X/Z)";
}
override
public void update(object obj, int amount)
{
Vector3 player = ((GameObject)obj).transform.position;
if (player.x >= coordinates.x - 1 && player.x <= coordinates.x + 1 && player.z >= coordinates.z - 1 && player.z <= coordinates.z + 1)
{
isFinished = true;
}
}
}
}