public virtual void LoadData(LivingData data) { // First, set the data species = data.species; firstName = data.firstName; lastName = data.lastName; health = data.health; maxHealth = data.maxHealth; hairType = data.hairType; topType = data.topType; bottomType = data.bottomType; GetComponent <SpriteRenderer>().color = new Color(data.skinColorR, data.skinColorG, data.skinColorB); animator.hairRenderer.color = new Color(data.hairColorR, data.hairColorG, data.hairColorB); animator.topRenderer.color = new Color(data.topColorR, data.topColorG, data.topColorB); animator.bottomRenderer.color = new Color(data.bottomColorR, data.bottomColorG, data.bottomColorB); healthEffects = (data.healthEffects != null) ? data.healthEffects : new List <HealthEffect>(); Inventory inventory = GetComponent <Inventory>(); if (inventory != null) { inventory.SetItems(data.inventory); } // Then set other stuff transform.position = data.position; // Load spirte animator = GetComponent <LivingAnimator>(); animator.LoadSprites(); }
private void Start() { animator = GetComponent <LivingAnimator>(); regenCoroutine = StartCoroutine(RegenerateHealth(false)); StartCoroutine(ProcessEffects()); }