72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
public class TaskSystem : MonoBehaviour
|
|
{
|
|
public void TaskEvent()
|
|
{
|
|
var levelData = JsonTab.Instance.tables.Level.Get(GameManager.ins.level);
|
|
var mainTask = levelData.Maintasks;
|
|
var secondaryTask = levelData.Additionaltasks;
|
|
}
|
|
|
|
public void Event(int id,float common)
|
|
{
|
|
var levelData = JsonTab.Instance.tables.Level.Get(GameManager.ins.level);
|
|
var data = JsonTab.Instance.tables.Task.Get(id);
|
|
switch (data.Tasktype)
|
|
{
|
|
case 1:
|
|
if (!DataManager.GetTask(GameManager.ins.level,id))
|
|
{
|
|
var leng = (float)levelData.Length * ((float)levelData.Target / 10000);
|
|
if (GameManager.ins.NowLenght>=leng)
|
|
{
|
|
DataManager.SetTask(GameManager.ins.level,id,true);
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
if (!DataManager.GetTask(GameManager.ins.level,id))
|
|
{
|
|
DataManager.SetTask(GameManager.ins.level,id,true);
|
|
}
|
|
break;
|
|
case 3:
|
|
if (!DataManager.GetTask(GameManager.ins.level,id))
|
|
{
|
|
if (DataManager.HighestRecordPoints(GameManager.ins.level)>data.Targetnumber)
|
|
{
|
|
DataManager.SetTask(GameManager.ins.level,id,true);
|
|
}
|
|
}
|
|
break;
|
|
case 4:
|
|
|
|
break;
|
|
case 5:
|
|
if (!DataManager.GetTask(GameManager.ins.level,id))
|
|
{
|
|
if (common<data.Targetnumber)
|
|
{
|
|
DataManager.SetTask(GameManager.ins.level,id,true);
|
|
}
|
|
}
|
|
break;
|
|
case 6:
|
|
if (!DataManager.GetTask(GameManager.ins.level,id))
|
|
{
|
|
if (common<data.Targetnumber)
|
|
{
|
|
DataManager.SetTask(GameManager.ins.level,id,true);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|