66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using QFramework;
|
|
using System;
|
|
using QFramework.Example;
|
|
using DG.Tweening;
|
|
public class ScaleAction : IAction
|
|
{
|
|
public ulong ActionID { get; set; }
|
|
public bool Deinited { get; set; }
|
|
public bool Paused { get; set; }
|
|
public ActionStatus Status { get; set; }
|
|
|
|
|
|
private static readonly SimpleObjectPool<ScaleAction> mPool =
|
|
new SimpleObjectPool<ScaleAction>(() => new ScaleAction(), null, 10);
|
|
|
|
Vector3 scale;
|
|
float time;
|
|
string path;
|
|
public static ScaleAction Allocate(string path, Vector3 scale, float time, System.Action onDelayFinish = null)
|
|
{
|
|
var retNode = mPool.Allocate();
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
retNode.Deinited = false;
|
|
retNode.Reset();
|
|
retNode.scale = scale;
|
|
retNode.time = time;
|
|
retNode.path = path;
|
|
return retNode;
|
|
}
|
|
|
|
|
|
|
|
public void Deinit()
|
|
{
|
|
if (!Deinited)
|
|
{
|
|
Deinited = true;
|
|
mPool.Recycle(this);
|
|
}
|
|
}
|
|
|
|
public void OnExecute(float dt)
|
|
{
|
|
}
|
|
|
|
public void OnFinish()
|
|
{
|
|
}
|
|
|
|
public void OnStart()
|
|
{
|
|
GameObject obj = Utility.FindObj(path);
|
|
obj.transform.DOScale(scale, time).onComplete = () => this.Finish(); ;
|
|
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
}
|