コード例 #1
0
        private void LoadUICanvas()
        {
            var canvas = ResourcesManager.Create("Prefabs/UICanvas");

            uiCanvas = canvas.GetComponent <UICanvasController>();
            canvas.DontDestroyOnLoad();
        }
コード例 #2
0
ファイル: SetManager.cs プロジェクト: Minhbo2/BullsAndCows
    public static T OpenSet <T>() where T : Set
    {
        string SetName = typeof(T).Name;

        if (Inst.Sets.Count > 0)
        {
            foreach (Set set in Inst.Sets)
            {
                if (set.name == SetName && set != null)
                {
                    ToggleSet(set);
                    return(set.GetComponent <T>());
                }
            }
        }

        GameObject SetGO = ResourcesManager.Create("Sets/" + SetName);

        SetGO.name = SetName;
        if (SetGO != null)
        {
            T CastedObject = SetGO.GetComponent <T>();

            if (CastedObject == null)
            {
                Debug.LogWarning(SetName + " didn't have a Set component attached, adding it now...");
                CastedObject = SetGO.AddComponent <T>();
            }

            Inst.Sets.Add(CastedObject);
            return(CastedObject);
        }
        return(null);
    }
コード例 #3
0
ファイル: BootInit.cs プロジェクト: Minhbo2/BullsAndCows
    void Start()
    {
        var App = ResourcesManager.Create("Game/App");

        if (App)
        {
            App.name = "App";

            var Game = ResourcesManager.Create("Game/Game");
            Game.name = "Game";

            Destroy(gameObject);
        }
    }
コード例 #4
0
    public void OutputResult(int Bulls, int Cows)
    {
        // make sure to always have a list
        if (RPList == null)
        {
            RPList = new List <ResultPrefabSet>();
        }

        RectTransform ContentArea = SMSet.ContentArea;

        if (ContentArea)
        {
            ResultPrefabSet Result = ResourcesManager.Create("Sets/ResultPrefabSet").GetComponent <ResultPrefabSet>();
            Result.transform.SetParent(ContentArea.transform, false);
            RPList.Add(Result);
            Result.GetPlayerGuess(PlayerGuess);
            SMSet.ManageContentAreaSize(Result.gameObject);
            TriesRemain(GM.BCGame.GetCurrentTry());
        }
    }
コード例 #5
0
ファイル: Seeker.cs プロジェクト: Minhbo2/GGJProject
    // Update is called once per frame
    void Update()
    {
        if (m_SignalCooldown != 0f && Signal != null)
        {
            m_SignalCooldown         -= Time.deltaTime;
            Signal.transform.position = gameObject.transform.position;
            Vector3 currentScale = Signal.transform.localScale;
            Signal.transform.localScale = new Vector3(currentScale.x * m_SignalSpeed, currentScale.y++, currentScale.z * m_SignalSpeed);
        }


        if (Input.GetKeyDown(KeyCode.Space) && m_SignalCooldown == 0f)
        {
            if (Signal == null)
            {
                Signal = ResourcesManager.Create("Player/Animation/SeekerSignal");
            }


            if (sonarClip != null)
            {
                sonarSound.clip  = sonarClip;
                sonarSound.pitch = .75f;
                sonarSound.Play();
            }
            else
            {
                Debug.Log("failed to find audio clip");
            }

            m_SignalCooldown = 5f;

            StartCoroutine(SignalCooldown(m_SignalCooldown));

            StartCoroutine(TransmitSignal(ScaleTime));
        }
        // Debug.Log(m_SignalCooldown);
    }
コード例 #6
0
ファイル: GameManager.cs プロジェクト: maguslin/ARShooter
    public override void OnInit()
    {
        Application.runInBackground  = true;
        Debug.unityLogger.logEnabled = true;        //打开log,发布正式版的时候关闭
        macAddress = SystemInfo.deviceUniqueIdentifier;

        //基本数据访问接口
        BaseDataManager.Create();

        //TouchListener.Create();

        //内存池创建
        MemoryDataManager.Create();

        //资源管理器创建
        ResourcesManager.Create();


        UIManager.Create();
        //UIManager.Create();
        LuaManager.Create();
        //网络
    }
コード例 #7
0
    public override void OnInit()
    {
        Application.runInBackground = true;
        Debug.logger.logEnabled     = true;    //打开log,发布正式版的时候关闭


        //基本数据访问接口
        BaseDataManager.Create();

        TouchListener.Create();

        //内存池创建
        MemoryDataManager.Create();

        //资源管理器创建
        ResourcesManager.Create();


        UIManager.Create();

        CatnapWebMgr.CreateSelf <CatnapWebMgr> ();       //网络暂时注掉了,之后会打开

        //TestGPS.Create ();//打开gps
    }
コード例 #8
0
ファイル: Game.cs プロジェクト: Minhbo2/BullsAndCows
    void Update()
    {
        switch (CurrentState)
        {
        case GameState.INIT:     // setting up all managers and game datas
            uiSetManager = SetManager.OpenSet <UISetManager>();
            soundManager = ResourcesManager.Create("Prefab/SoundManager").GetComponent <SoundManager>();
            uiSetManager.NextActiveSet("Intro");

            bool FileExist = File.Exists(Application.persistentDataPath + "bcgame.dat");
            if (FileExist)
            {
                NewData = new Data();
                NewData = SaveData.LoadData <Data>("bcgame.dat");
                HighestRoundCompleted = NewData.Round;
                IsTutorialComplete    = NewData.IsTutorialComplete;
            }


            BCGame.IsogramWords = LoadWordsList.GetWordsFile();
            GameIsWaiting       = true;

            if (GameIsWaiting)
            {
                ChangeState(GameState.WAITING);
            }
            break;

        case GameState.WAITING:     // waiting for input from player, reset gameplay
            LevelTime           = 300;
            BCGame.CurrentRound = 1;

            bool UserInput = Input.anyKey;
            TimeToQuit -= Time.deltaTime;
            if (TimeToQuit <= 0)
            {
                App.Inst.Quit();
            }
            else if (UserInput && TimeToQuit > 0)
            {
                TimeToQuit = 120f;
            }


            if (GameIsLoading)
            {
                ChangeState(GameState.LOADING);
            }
            break;

        case GameState.LOADING:     // get neccessary datas for the game to start
            PlayGame();
            uiSetManager.NextActiveSet("Game Set");
            if (GameIsRunning)
            {
                ChangeState(GameState.RUNNING);
            }
            break;

        case GameState.RUNNING:     // check if win or lose, save data
            if (IsRoundStarted)
            {
                LevelTime -= Time.deltaTime;
                bool bRoundIncomplete = BCGame.GetCurrentTry() > BCGame.GetMaxTry();
                if (bRoundIncomplete || LevelTime < 0)
                {
                    IsRoundStarted = false;
                    uiSetManager.NextActiveSet("Summary");
                    soundManager.PlayWinLose(!bRoundIncomplete);
                    ChangeState(GameState.WAITING);
                }
            }

            if (GameIsLoading)
            {
                ChangeState(GameState.LOADING);
            }
            else if (GameIsWaiting)
            {
                ChangeState(GameState.WAITING);
            }
            break;
        }



        if (Input.GetKeyDown(KeyCode.Space))
        {
            print(BCGame.MyHiddenWord);
        }
    }