protected virtual void Awake() { _instanceObject = gameObject; _name = InstanceObject.name; _rigidbody = InstanceObject.GetComponent <Rigidbody>(); _myTransform = InstanceObject.transform; }
public virtual void Update() { if (!isDead) { return; } Destroy(InstanceObject.GetComponent <Collider>()); Destroy(InstanceObject, 1f); }
protected virtual void Awake() { InstanceObject = gameObject; Name = InstanceObject.name; if (GetComponent <Renderer>()) { Material = GetComponent <Renderer>().material; } Rigidbody = InstanceObject.GetComponent <Rigidbody>(); MyTransform = InstanceObject.transform; }
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); } } }
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); } } }
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); } }