void Awake() { tr = transform; rgd = rigidbody; lvt = GetComponent<Levitatable>(); WillDieSoon = Random.value > ChanceOfInstaDeath; if (WillDieSoon) { AttachKillComponent(); } }
public void OnTrigger(WandController wand) { RaycastHit hitInfo; bool isIntersect = Physics.Raycast(transform.position, transform.forward, out hitInfo); if (isIntersect == false) { return; } Debug.Log(hitInfo.point); Collider[] colliders = Physics.OverlapSphere(hitInfo.point, this.radius); foreach (Collider c in colliders) { if (c.GetComponent <Rigidbody>() == null) { continue; } // don't blow away the player's hand if (c.gameObject.CompareTag("Player")) { continue; } Debug.Log(c); c.GetComponent <Rigidbody>().AddForce(transform.forward * force, ForceMode.Impulse); // add lingering particle effect if (effectParticleSystem != null) { GameObject effect = Instantiate(effectParticleSystem, c.transform.position, c.transform.rotation) as GameObject; effect.transform.parent = c.gameObject.transform; Destroy(effect, 10); } // TODO abstract the effect of spell out of the ray damage Levitatable levitation = c.GetComponent <Levitatable>(); if (levitation != null) { levitation.activate(!levitation.isActive()); } } }
void Awake() { pf = GetComponent<PathFollower>(); lvt = GetComponent<Levitatable>(); if (PathStarts == null) { PathStarts = GameObject.FindObjectsOfType<ConveyorBeltStartNode>().Select(cbsn => cbsn.GetComponent<PathNode>()).ToArray(); } spawningObject = null; if (RespawnOnStart) { isWaitingToSpawn = true; } else { isWaitingToSpawn = false; } }
void Awake() { levitator = GetComponent<Levitatable>(); }