Added inheritance for quests, finished quest implementation (90%), v1.4.0
This commit is contained in:
29
Assets/Scripts/Quests/ExploreQuest.cs
Normal file
29
Assets/Scripts/Quests/ExploreQuest.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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(20) - 10;
|
||||
float coordZ = getRandomNumber(20) - 10;
|
||||
coordinates = new Vector3(playerPos.x + coordX, 0, playerPos.z + coordZ);
|
||||
questname = "Travel to " + coordinates.x + "/" + coordinates.z + "(X/Z)";
|
||||
}
|
||||
|
||||
override
|
||||
public void update(object obj, int amount)
|
||||
{
|
||||
Vector3 player = ((GameObject)obj).transform.position;
|
||||
if (player.x - 5 >= coordinates.x && player.x + 5 <= coordinates.x && player.z - 5 >= coordinates.z && player.z + 5 <= coordinates.z)
|
||||
{
|
||||
isFinished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user