Exemple #1
0
    /// <summary>
    /// Enables a given menu
    /// </summary>
    /// <param name="_menu"></param>
    public void EnableMenu(MenuActive _menu)
    {
        switch (_menu)
        {
        case MenuActive.GAME:
            ActivateUICanvas(false, "GameCanvas");
            GameObject.FindGameObjectWithTag("UI/GameCanvas").GetComponent <Canvas>().enabled = true;
            ActivateChild(GameObject.FindWithTag("UI/GameCanvas"), "", true);
            menuActive = MenuActive.GAME;
            break;

        case MenuActive.MENU:
            GameObject.FindGameObjectWithTag("UI/MenuCanvas").GetComponent <Canvas>().enabled = true;
            ActivateUICanvas(false, "MenuCanvas");
            menuActive = MenuActive.MENU;
            break;

        case MenuActive.RETRY:
            GameObject.FindGameObjectWithTag("UI/RetryCanvas").GetComponent <Canvas>().enabled = true;
            ActivateUICanvas(false, "RetryCanvas");
            menuActive = MenuActive.RETRY;
            break;

        case MenuActive.INVENTORY:
            GameObject.FindGameObjectWithTag("UI/InventoryCanvas").GetComponent <Canvas>().enabled = true;
            ActivateUICanvas(false, "InventoryCanvas");
            ActivateChild(GameObject.FindWithTag("UI/GameCanvas"), "QuickItem", false);
            menuActive = MenuActive.INVENTORY;
            break;
        }
    }
Exemple #2
0
    void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }

        SetCursorTexture((Texture2D)Resources.Load("UI/cursor"));
        controllerProfile    = ControllerProfile.WASD;
        menuActive           = MenuActive.MENU;
        customKey            = new KeyCode[8];
        TogglePlayerMovement = true;
        navMeshController    = GameObject.FindWithTag("Manager/NavMeshManager").GetComponent <NavMeshController>();
        projectileManager    = GameObject.FindWithTag("Manager/ProjectileManager").GetComponent <ProjectileManager>();
        buffManager          = GameObject.FindWithTag("Manager/BuffManager").GetComponent <BuffManager>();
        _largeProjectile     = (GameObject)Resources.Load("Prefabs/LargeProjectile");
        _smallProjectile     = (GameObject)Resources.Load("Prefabs/SmallProjectile");
        _smoke             = (GameObject)Resources.Load("Prefabs/Particles/Smoke");
        _bot               = (GameObject)Resources.Load("Prefabs/Bot");
        _blankImage        = GameObject.FindWithTag("UI/GameCanvas").transform.FindChild("Blank").GetComponent <Image>();
        _shootEffectPrefab = (GameObject)Resources.Load("Prefabs/Particles/ShootEffect");
        activeEntities     = GameObject.FindWithTag("ActiveEntities");
        Player             = GameObject.FindGameObjectWithTag("Player");

        inventoryManager = new InventoryManager();
        AddQuickItemSlotToList();
        EnableMenu(MenuActive.MENU);


        if (EventManager.OnShoot != null)
        {
            EventManager.OnShoot();
        }
    }