34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Assets.Scripts.Player;
|
|
using Newtonsoft.Json.Linq;
|
|
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<PlayerGameObject>().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)";
|
|
}
|
|
|
|
public ExploreQuest(JToken token, GameObject display) : base(token, display) { }
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|