Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Это архивный репозиторий. Вы можете его клонировать или просматривать файлы, но не вносить изменения или открывать задачи/запросы на слияние.
|
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- namespace coa4u
- {
- /// <summary>
- /// Instantly rotates the target to face the given point or actor.
- /// </summary>
- class ActionSetDirection : ActionInstant
- {
- protected Vector3 value;
- protected Actor other;
-
- public ActionSetDirection(Vector3 tgtValue)
- : base()
- {
- value = tgtValue;
- }
-
- public ActionSetDirection(Vector2 tgtValue)
- : this((Vector3)tgtValue)
- {
- is2d = true;
- }
-
- public ActionSetDirection(Actor tgtActor)
- : base()
- {
- other = tgtActor;
- }
-
- /// <summary>
- /// Returns a copy of the action.
- /// </summary>
- public override ActionInstant clone()
- {
- return new ActionSetDirection(value);
- }
-
- /// <summary>
- /// This method is called at the action start.
- /// </summary>
- public override void start()
- {
- base.start();
- if (other != null)
- {
- value = other.transform.position;
- }
- if (is2d)
- {
- value.z = transform.position.z;
- }
- transform.rotation = Quaternion.LookRotation(transform.position - value);
- }
- }
- }
|