You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.3 KiB
63 lines
1.3 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using DG.Tweening;
|
|
|
|
public static class Const
|
|
{
|
|
|
|
|
|
|
|
|
|
public static GameObject LoadPrefab(string path,Vector3 pos,Vector3 rote,Vector3 scale)
|
|
{
|
|
GameObject go = Resources.Load<GameObject>(path);
|
|
if (go != null)
|
|
{
|
|
go = GameObject.Instantiate(go, pos, Quaternion.Euler(rote));
|
|
go.transform.localScale = scale;
|
|
return go;
|
|
}
|
|
return null;
|
|
}
|
|
public static GameObject LoadPrefab(string path)
|
|
{
|
|
GameObject go = Resources.Load<GameObject>(path);
|
|
if (go != null)
|
|
{
|
|
go = GameObject.Instantiate(go);
|
|
|
|
return go;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="time">多少秒</param>
|
|
/// <param name="action">委托</param>
|
|
/// <returns></returns>
|
|
public static IEnumerator TimedTask(float time,Action action)
|
|
{
|
|
yield return new WaitForSeconds(time);
|
|
action();
|
|
|
|
}
|
|
|
|
public static void Domove(Transform trans,Vector3 pos,float time)
|
|
{
|
|
trans.DOMove(pos, time);
|
|
|
|
}
|
|
|
|
public static void DoRotate(Transform trans, Vector3 eulerAngles, float time)
|
|
{
|
|
trans.DORotate(eulerAngles, time);
|
|
}
|
|
|
|
|
|
}
|