using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Linq; using Janus; [Script(ScriptRole.View)] public class DinoView : MonoBehaviour { public List<SpriteRenderer> ColoredSprites; DinoLogic _logic; Animator _animator; int _runPowerHash = Animator.StringToHash("RunPower"); int _hasEggHash = Animator.StringToHash("HasEgg"); Color _spriteColor; void Awake() { _logic = GetComponent<DinoLogic>(); _animator = GetComponent<Animator>(); } void OnSpawn(UJeli details) { _logic.HasEgg.EntryPassed += HasEggChanged; } private void HasEggChanged(Timeline<bool> timeline, TimelineEntry<bool> entry) { if (entry.Value) this.PlayPooledSound("item_picked_up"); _animator.SetBool(_hasEggHash, entry.Value); } public void SetColor(Color color) { _spriteColor = color; foreach (var sprite in ColoredSprites) sprite.color = _spriteColor; } void Update() { _animator.SetFloat(_runPowerHash, _logic.RunPower.LastValue); } void OnSkillUsed(Character character, Persona persona) { } void OnDespawn() { } }