Added inheritance for quests, finished quest implementation (90%), v1.4.0
This commit is contained in:
52
Assets/Scripts/Quests/Quest.cs
Normal file
52
Assets/Scripts/Quests/Quest.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class Quest
|
||||
{
|
||||
protected string questname;
|
||||
protected string keyword;
|
||||
protected int current;
|
||||
protected int goal;
|
||||
protected bool isFinished = false;
|
||||
protected Vector3 coordinates;
|
||||
protected GameObject display;
|
||||
|
||||
public Quest(GameObject display)
|
||||
{
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public virtual void update(object obj, int amount)
|
||||
{
|
||||
//empty
|
||||
}
|
||||
|
||||
public void show(float positionY)
|
||||
{
|
||||
display.transform.Find("txtName").GetComponent<Text>().text = questname;
|
||||
display.transform.Find("txtAmount").GetComponent<Text>().text = current + "/" + goal;
|
||||
if (isFinished)
|
||||
{
|
||||
display.transform.Find("imgDone").GetComponent<RawImage>().color = new Color(255,255,255,255);
|
||||
}
|
||||
float x = display.transform.localPosition.x;
|
||||
float z = display.transform.localPosition.z;
|
||||
display.transform.localPosition = new Vector3(x, positionY, z);
|
||||
}
|
||||
|
||||
public int getRandomNumber(int max)
|
||||
{
|
||||
int result = 0;
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
result = Random.Range(0,max);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user