Example #1
0
    //в авейке все это работает плохо
    protected void Start()
    {
        //Debug.Log("WeaponSelector Start");

        debugmanager = GameObject.Find("DebugManager").GetComponent<DebugManager>();

        uimanager = GameObject.Find("UIManager").GetComponent<UIManager>();
        uimanager.OnCall_WSelector += MoveandAppeare;
        uimanager.OnCloseGUI += Disappeare;
        uimanager.OnPress_WButton += ShowRadius;
        uimanager.OnCloseGUI += HideRadius;
        _transform = transform;
        _gameObject = gameObject;
        _gameObject.SetActive(false);

        _weaponmanager = _camera.GetComponent<WeaponManager>();
        _resourceManager = _camera.GetComponent<ResourceManager>();

        radiusGM = GameObject.Find("Radius");
        radiusT = radiusGM.transform;

        foreach (Transform t in _transform)
        {
            if (t.name.Contains("WButton"))
            {
                SelectorButton button = t.GetComponent<SelectorButton>();
                WeaponType weapondata = _weaponmanager.GetPrimaryWeaponData(button.id);
                //Debug.Log("but " + id);

                if (weapondata != null)
                {
                    button.SetWButtonState(weapondata);
                }
                else
                {
                    button.SetButtonLock(LockSprite);
                }
            }
        }
    }