Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
Це архівний репозитарій. Ви можете переглядати і клонувати файли, але не можете робити пуш або відкривати питання/запити.
|
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- namespace coa4u
- {
- class ActionScaleTo : ActionInterval
- {
- protected Vector3 value;
- protected Vector3 path;
-
- public ActionScaleTo(Vector3 tgtValue, float tgtDuration)
- : base(tgtDuration)
- {
- value = tgtValue;
- }
-
- public ActionScaleTo(Vector2 tgtValue, float tgtDuration)
- : this((Vector3)tgtValue, tgtDuration)
- {
- is2d = true;
- }
-
- public override ActionInstant clone()
- {
- return new ActionScaleTo(value, duration);
- }
-
- public override void start()
- {
- base.start();
- if (is2d)
- value.z = transform.localScale.z;
- path = value - transform.localScale;
- }
-
- public override void stepInterval(float dt)
- {
- float d = dt / duration;
- Vector3 tgt = path * d;
- transform.localScale += tgt;
- }
- }
- }
|