/// <summary>
        ///
        /// </summary>
        public bool ScatterSupply()
        {
            var supply = resources.supply;

            if (supply > 0 && GetComponent <NoSupplyPickupBuff>() == null)
            {
                resources.TakeSupply(supply);
                GameplayStatics.ScatterSupply(transform, supply);

                TryAddBuff <NoSupplyPickupBuff>(0.5f);
                return(true);
            }
            return(false);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        public void BeginDestroy()
        {
            if (_isDestroyed)
            {
                return;
            }

            _isDestroyed = true;
            this.EmitSound(DestroySoundKey);

            if (_destroyAnimation != null)
            {
                GameplayStatics.SpawnFireAndForgetAnimation(_destroyAnimation, transform.position, transform.rotation)
                .AddComponent <TileObjectRenderer>();
            }
            GameplayStatics.ScatterSupply(transform, _supplyCost);

            Destroy(gameObject);
        }