using System.Collections; using System.Collections.Generic; using UnityEngine; using wildlogicgames; namespace DoomBreakers { public class Chicken : ItemBase { private double _healingValue; public double Health() => _healingValue; public Chicken() { } public override void Awake() => Initialize(this.GetComponent(), this.GetComponent(), HealingItemType.Chicken); public override void Initialize(SpriteRenderer spriteRenderer, Animator animator, HealingItemType healingItemType) { _itemBehaviour = this.gameObject.AddComponent(); _itemBehaviour.Setup(this.transform, this.GetComponent(), this.GetComponent()); _itemAnimator = new ItemAnimator(animator, "ItemAnimControllers", "HealthItems", "Health", HealingItemType.Chicken); _healingValue = 0.1; //base.SetupOptimization(this.transform, this.transform.position); } public override void Start() => base.Start(); public override void Update() //=> base.Update(); { base.Update(); if (_destroyFlag) this.enabled = false; } public void DestroyThis() { _optimizeFlag = false; _destroyFlag = true; if (_itemBehaviour != null) _itemBehaviour.DisableCollisions(); //Especially important for player Equip Indicator usage. if (_itemAnimator != null) _itemAnimator.UpdateAnimator(); if (_itemBehaviour != null) _itemBehaviour.UpdateMovement(); if (_itemAnimator != null) _itemAnimator.GetAnimator().enabled = false; _itemAnimator = null; //_itemBehaviour = null; this.gameObject.GetComponent().Sleep(); this.gameObject.GetComponent().enabled = false; this.gameObject.GetComponent().enabled = false; this.gameObject.SetActive(false); } } }