private void ExitAbsorber() { if (_activeAbsorber != null) { _activeAbsorberScript.HideLinks(); } _activeAbsorber = null; _activeAbsorberScript = null; _controller.Unlock(); }
public void DisplayLinks() { foreach (KeyValuePair <GameObject, LineRenderer> pair in _links) { Absorber other = pair.Key.GetComponent <Absorber>(); LineRenderer link = pair.Value; if (other.Active) { link.enabled = true; } } }
private bool GetClickedObject() { Collider2D hit = Physics2D.OverlapPoint(Camera.main.ScreenToWorldPoint(Input.mousePosition)); if (hit && hit.tag == "Absorber") { if (_activeAbsorber) { if (_activeAbsorberScript.linkedAbsorbers.Contains(hit.gameObject)) { Absorber absorberScript = hit.transform.GetComponent <Absorber>(); if (!absorberScript.Active) { return(false); } _activeAbsorberScript.HideLinks(); _activeAbsorber = hit.transform; _activeAbsorberScript = absorberScript; return(true); } } if (_absorbers.Count > 0 && _absorbers.Contains(hit.transform)) { Absorber absorberScript = hit.transform.GetComponent <Absorber>(); if (!absorberScript.Active) { return(false); } _activeAbsorber = hit.transform; _activeAbsorberScript = absorberScript; return(true); } } return(false); }
private void Awake() { absorber = GetComponent <Absorber>(); linesOnScreen = new List <LineRenderer>(); }
private void Start() { myCamera = GetComponent <Camera>(); zoomAbsorbToFollow = toFollow.GetComponent <Absorber>(); }
private void Start() { gm = FindObjectOfType <GameManager>(); absorber = FindObjectOfType <Absorber>(); }