using System.Collections; using System.Collections.Generic; using UnityEngine; using wildlogicgames; namespace DoomBreakers { public class Ruby : ItemBase { private int _currencyValue; public int Amount() => _currencyValue; public Ruby() { } public override void Awake() => Initialize(this.GetComponent(), this.GetComponent(), CurrencyItemType.Ruby); public override void Initialize(SpriteRenderer spriteRenderer, Animator animator, CurrencyItemType currencyItemType) { _itemBehaviour = this.gameObject.AddComponent(); _itemBehaviour.Setup(this.transform, this.GetComponent(), this.GetComponent()); _itemAnimator = new ItemAnimator(animator, "ItemAnimControllers", "Currency", "Currency", CurrencyItemType.Ruby); _currencyValue = 3; //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); } } }