示例#1
0
 private void ExitAbsorber()
 {
     if (_activeAbsorber != null)
     {
         _activeAbsorberScript.HideLinks();
     }
     _activeAbsorber       = null;
     _activeAbsorberScript = null;
     _controller.Unlock();
 }
示例#2
0
    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;
            }
        }
    }
示例#3
0
    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);
    }
示例#4
0
 private void Awake()
 {
     absorber      = GetComponent <Absorber>();
     linesOnScreen = new List <LineRenderer>();
 }
示例#5
0
 private void Start()
 {
     myCamera           = GetComponent <Camera>();
     zoomAbsorbToFollow = toFollow.GetComponent <Absorber>();
 }
示例#6
0
 private void Start()
 {
     gm       = FindObjectOfType <GameManager>();
     absorber = FindObjectOfType <Absorber>();
 }