protected virtual void LowVelocity() { if (hold == false && currentVelocity > 0) { if (currentVelocity < limitVelocity && gameObject.tag == "ThrownMovable") { if (slowMoTrigger == null) { slowMoTrigger = transform.GetComponentInChildren <SlowMotionTriggerScript>(); } slowMoTrigger.triggerEnabled = false; gameObject.tag = "Movable"; } } }
protected virtual void HighVelocity() { if (hold == false && currentVelocity > 0) { if (currentVelocity > limitVelocity) { if (slowMoTrigger == null) { slowMoTrigger = transform.GetComponentInChildren <SlowMotionTriggerScript>(); } if (tag == "ThrownMovable" || tag == "DeadCube") { slowMoTrigger.triggerEnabled = true; } } } }
public virtual void OnEnable() { hold = false; rigidbodyMovable = GetComponent <Rigidbody>(); movableRenderer = GetComponent <Renderer>(); cubeMeshFilter = transform.GetChild(2).GetComponent <MeshFilter>(); cubeMaterial = transform.GetChild(1).GetComponent <Renderer>().material; deadlyParticle = transform.GetChild(3).GetComponent <ParticleSystem>(); deadlyParticle2 = transform.GetChild(4).GetComponent <ParticleSystem>(); slowMoTrigger = transform.GetComponentInChildren <SlowMotionTriggerScript>(); deadlyParticle.Stop(); deadlyParticle2.Stop(); cubeMeshFilter.mesh = GlobalVariables.Instance.cubesStripes[Random.Range(0, GlobalVariables.Instance.cubesStripes.Length)]; attracedBy.Clear(); repulsedBy.Clear(); }