58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using asap.core;
|
|
using Cinemachine;
|
|
using UnityEngine;
|
|
|
|
namespace Script.RuntimeScript
|
|
{
|
|
public class DiggingGameInit : MonoBehaviour
|
|
{
|
|
public GameObject BroadContainer;
|
|
public GameObject GridContianer;
|
|
public GameObject GridPropContianer;
|
|
public GameObject PropContainer;
|
|
public Texture2D CursorImg;
|
|
public CinemachineVirtualCamera CameraVir;
|
|
public GameObject ShowPropPositon;
|
|
public Transform FxRoot;
|
|
public DiggingMoveCurve diggingMoveCurve;
|
|
bool isStart = false;
|
|
public async Task OnStart()
|
|
{
|
|
isStart = true;
|
|
DiggingGameManager diggingGameManager = GContext.container.Resolve<DiggingGameManager>();
|
|
diggingGameManager.diggingMoveCurve = diggingMoveCurve;
|
|
await diggingGameManager.InitGame(this, CameraVir, BroadContainer, GridContianer, GridPropContianer, PropContainer, ShowPropPositon, FxRoot);
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (isStart)
|
|
{
|
|
GContext.container.Resolve<DiggingGameManager>().Update();
|
|
}
|
|
}
|
|
public void OnDestroy()
|
|
{
|
|
GContext.container.Resolve<DiggingGameManager>().Destroy();
|
|
}
|
|
}
|
|
[Serializable]
|
|
public class DiggingMoveCurve
|
|
{
|
|
[Tooltip("x轴路线形状 起始和结尾 点值必须为0")]
|
|
public AnimationCurve CurveX;
|
|
[Tooltip("y轴路线形状 起始和结尾 点值必须为0")]
|
|
public AnimationCurve CurveY;
|
|
[Tooltip("z轴路线形状 起始和结尾 点值必须为0")]
|
|
public AnimationCurve CurveZ;
|
|
[Tooltip("y轴运动速度 结尾点值必须为1")]
|
|
public AnimationCurve CurveSpeedY;
|
|
[Tooltip("z轴运动速度 结尾点值必须为1")]
|
|
public AnimationCurve CurveSpeedZ;
|
|
[Tooltip("弧度缩放系数")]
|
|
public float RadianScale = 1f;
|
|
}
|
|
}
|