Пример #1
0
    void Start()
    {
        GUIhSize = Screen.height * GUIregion;
        GUIwSize = Screen.width * GUIregion;

        recDown  = new Rect(0, 0, Screen.width, GUIhSize);
        recUp    = new Rect(0, Screen.height - GUIhSize, Screen.width, GUIhSize);
        recLeft  = new Rect(0, 0, GUIwSize, Screen.height);
        recRight = new Rect(Screen.width - GUIwSize, 0, GUIwSize, Screen.height);

        selectionBox = gameObject.GetComponent <CreateSelectionBox>();
    }
Пример #2
0
    void Start()
    {
        GUIhSize = Screen.height * GUIregion;
        GUIwSize = Screen.width * GUIregion;

        recDown  = new Rect(0, 0, Screen.width, GUIhSize);
        recUp    = new Rect(0, Screen.height-GUIhSize, Screen.width, GUIhSize);
        recLeft  = new Rect(0, 0, GUIwSize, Screen.height);
        recRight = new Rect(Screen.width-GUIwSize, 0, GUIwSize, Screen.height);

        selectionBox = gameObject.GetComponent<CreateSelectionBox>();
    }
Пример #3
0
    void Update()
    {
        if (Input.GetMouseButton(0) && selectionBox.selecting && renderer.isVisible)
        {
            Vector3 camPos = Camera.mainCamera.WorldToScreenPoint(transform.position);
            camPos.y = CreateSelectionBox.InvertMouseY(camPos.y);
            selected = CreateSelectionBox.selection.Contains(camPos);
        }
        else if (Input.GetMouseButton(0) && selectionBox.selecting && !renderer.isVisible)
        {
            selected = false;
        }

        if (selected && selectionBox.selecting)
        {
            unitManager.SelectAdditionalUnit(gameObject);
        }
        else if (selectionBox.selecting)
        {
            unitManager.DeselectUnit(gameObject);
        }
    }
Пример #4
0
 void Start()
 {
     unitManager         = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent <UnitManager>();
     attackMoveIndicator = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent <AttackMoveIndicatorScript>();
     selectionBox        = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CreateSelectionBox>();
 }
Пример #5
0
 void Start()
 {
     unitManager = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent<UnitManager>();
     attackMoveIndicator = GameObject.FindGameObjectWithTag("PlayerUnitManager").GetComponent<AttackMoveIndicatorScript>();
     selectionBox = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CreateSelectionBox>();
 }