using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Linq; using Janus; [Script(ScriptRole.Logic)] public class DinoLogic : MonoBehaviour { public float RunAcceleration; public float RunSpeed; public float MovementTurnPower; public Timeline<Vector3> Aim; public Timeline<float> RunPower; public Timeline<bool> HasEgg; public Timeline<int> Score; public float DesiredRunSpeed { get { return RunPower.LastValue * RunSpeed; } } void Awake () { Aim = Sync.CreateContinuousState<Vector3>(); RunPower = Sync.CreateContinuousState<float>(); HasEgg = Sync.CreateDiscreteState<bool>(); Score = Sync.CreateDiscreteState<int>(); } void OnSpawn (UJeli details) { Aim[0] = -transform.position.normalized; RunPower[0] = 0; transform.up = -transform.position.normalized; } void Update () { float finalAcceleration = RunAcceleration; float finalRunSpeed = DesiredRunSpeed; Vector3 finalAim = Aim.LastValue; rigidbody.Accelerate(transform.up * finalRunSpeed, finalAcceleration); if (finalAim != Vector3.zero) rigidbody.RollToward(finalAim, MovementTurnPower * Time.deltaTime); } void OnSkillUsed (Character character, Persona persona) { } void OnDespawn () { } }