コード例 #1
0
    private void CleanSelectedItem()
    {
        if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && !onItem)
        {
            if (curBaseScript)
            {
                curBaseScript.CloseBaseMenu();
                curBaseScript.SetSelected(false);
            }
            if (currentArmyScript)
            {
                currentArmyScript.SetSelected(false);
            }

            selectedItem      = null;
            curBaseScript     = null;
            currentArmyScript = null;
        }
    }
コード例 #2
0
    private void SelectItemPlayerOn()
    {
        if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && onItem)
        {
            if (itemOn.tag.Equals("Base") && itemOn.GetComponent <BaseScript>().GetOwner() == owner)
            {
                curBaseScript = itemOn.GetComponent <BaseScript>();
                curBaseScript.SetSelected(onItem);
                Debug.Log("Select: Base");
            }
            else if (itemOn.tag.Equals("Unit") && itemOn.GetComponent <ArmyScript>().GetOwner() == owner)
            {
                currentArmyScript = itemOn.GetComponent <ArmyScript>();
                currentArmyScript.SetSelected(onItem);
                Debug.Log("Select: Army");
            }

            selectedItem = itemOn;
        }
    }