Example #1
0
 protected virtual void Awake()
 {
     _instanceObject = gameObject;
     _name           = InstanceObject.name;
     _rigidbody      = InstanceObject.GetComponent <Rigidbody>();
     _myTransform    = InstanceObject.transform;
 }
Example #2
0
        public virtual void Update()
        {
            if (!isDead)
            {
                return;
            }

            Destroy(InstanceObject.GetComponent <Collider>());
            Destroy(InstanceObject, 1f);
        }
Example #3
0
 protected virtual void Awake()
 {
     InstanceObject = gameObject;
     Name           = InstanceObject.name;
     if (GetComponent <Renderer>())
     {
         Material = GetComponent <Renderer>().material;
     }
     Rigidbody   = InstanceObject.GetComponent <Rigidbody>();
     MyTransform = InstanceObject.transform;
 }
Example #4
0
 public void Update()
 {
     if (_isDead)
     {
         Color color = GetMaterial.color;
         if (color.a > 0)
         {
             color.a -= step / 100;
             Color    = color;
         }
         if (color.a < 1)
         {
             Destroy(InstanceObject.GetComponent <Collider>());
             Destroy(InstanceObject, _timeToDestroy);
         }
     }
 }
Example #5
0
 void Update()
 {
     if (_isDead)             //запускаем анимацию смерти
     {
         Color color = GetMaterial.color;
         if (color.a > 0)                 // понижаем альфа-канал (плавное затухание)
         {
             color.a -= _step / 100;
             Color    = color;
         }
         if (color.a < 1)
         {
             Destroy(InstanceObject.GetComponent <Collider> ());
             Destroy(InstanceObject, 5f);
         }
     }
 }
Example #6
0
        public override void Update()
        {
            if (!isDead)
            {
                return;
            }

            var scale = transform.localScale;

            if (!scale.Less(_deathScale))
            {
                transform.localScale = scale.Subtraction(step);
            }
            else
            {
                Destroy(InstanceObject.GetComponent <Collider>());
                Destroy(InstanceObject, 1f);
            }
        }