|
1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- class ActionScaleTo : ActionInterval
- {
- protected Vector3 value;
- protected Vector3 path;
-
- public ActionScaleTo(Vector3 tgtValue, float tgtDuration)
- : base(tgtDuration)
- {
- value = tgtValue;
- }
-
- public override Action clone()
- {
- return new ActionScaleTo(value, duration);
- }
-
- public override void start()
- {
- base.start();
- path = value - target.gameObject.transform.localScale;
- }
-
- public override void stepInterval(float dt)
- {
- float d = dt / duration;
- Vector3 tgt = path * d;
- target.gameObject.transform.localScale += tgt;
- }
-
- public override void stop()
- {
- base.stop();
- }
- }
|