public static void UnregisterObject(GlowObjectCmd glowObj) { if (_instance != null) { _instance._glowableObjects.Remove(glowObj); } }
/// <summary> /// TODO: Add a degister method. /// </summary> public static void RegisterObject(GlowObjectCmd glowObj) { if (_instance != null) { _instance._glowableObjects.Add(glowObj); } }
public static void DegisterObject(GlowObjectCmd glowObj) { if (_instance._glowableObjects.Contains(glowObj)) { _instance._glowableObjects.Remove(glowObj); } }
public static void DeleteObject(GlowObjectCmd glowObj) { if (Instance != null) { Instance._glowableObjects.Remove(glowObj); } }
// Use this for initialization void Start() { m_glow = GetComponent <GlowObjectCmd>(); if (m_glow) { m_glow.enabled = false; } StartCoroutine(WaitTheTowerToShine()); }
// Use this for initialization void Start() { m_glow = GetComponent <GlowObjectCmd>(); if (m_glow) { m_glow.GlowColor = Color.yellow; } m_audioSource = GetComponent <AudioSource>(); m_audioSources = GetComponents <AudioSource>(); }
private void FixedUpdate() { checkClosestObject(); if (closestInteractableObject != null) { GlowObjectCmd glow = closestInteractableObject.GetComponent <GlowObjectCmd>(); if (glow != null) { glow.Glow(); } } behaviour.Move(move * Time.fixedDeltaTime); animate.SetFloat("Speed", move); animate.SetBool("Jump", jump); animate.SetFloat("YSpeed", rigidBody.velocity.y); behaviour.changeLayer(moveZ); moveZ = 0; }
private void checkClosestObject() { Physics.OverlapSphereNonAlloc(this.transform.position, this.actionRadius, this.possibleInteractableObjects); Collider closest = null; for (int i = 0; i < this.possibleInteractableObjects.Length; i++) { if (this.possibleInteractableObjects[i] == null) { break; } var collider = this.possibleInteractableObjects[i]; if (collider.GetComponent <IActionable>() != null) { if (closest != null) { if ((this.transform.position - collider.gameObject.transform.position).magnitude < (this.transform.position - closest.transform.position).magnitude) { closest = collider; } } else { closest = collider; } } this.possibleInteractableObjects[i] = null; } if (closest != null) { if (closestInteractableObject != null) { if (closest.gameObject != closestInteractableObject) { GlowObjectCmd glow = closestInteractableObject.GetComponent <GlowObjectCmd>(); if (glow != null) { glow.StopGlowing(); } closestInteractableObject = closest.gameObject; } } else { closestInteractableObject = closest.gameObject; } } else { if (closestInteractableObject != null) { GlowObjectCmd glow = closestInteractableObject.GetComponent <GlowObjectCmd>(); if (glow != null) { glow.StopGlowing(); } } closestInteractableObject = null; } }
private void Awake() { glowSelector = GetComponent <GlowObjectCmd>(); }