Пример #1
0
 private void Awake()
 {
     _player = FindObjectOfType <Player>();
     _player.OnEntitySelected   += UpdateMenuType;
     _player.OnEntityDeselected += () => { ChangeMenu(PlayerMenuType.Build); };
     _buildMenu   = transform.Find("BuildMenu").GetComponent <BuildMenu>();
     _useMenu     = transform.Find("UseMenu").GetComponent <UseMenu>();
     _currentType = PlayerMenuType.Build;
     _currentMenu = _buildMenu;
 }
Пример #2
0
    public void ChangeMenu(PlayerMenuType type)
    {
        if (type == _currentType)
        {
            return;
        }

        _currentMenu.gameObject.SetActive(false);
        switch (type)
        {
        case PlayerMenuType.Build:
            _currentMenu = _buildMenu;
            break;

        case PlayerMenuType.Edit:
            break;

        case PlayerMenuType.Use:
            _currentMenu = _useMenu;
            break;
        }
        _currentType = type;
        _currentMenu.gameObject.SetActive(true);
    }