コード例 #1
0
ファイル: IntroState.cs プロジェクト: fnatte/TowerDefence
        public override void Initialize()
        {
            base.Initialize();

            introScene.Initialize();
            introScene.LoadContent();
        }
コード例 #2
0
 void Start()
 {
     introScene = new IntroScene();
     introScene.Initialize();
     nutsAmount        = 0;
     NameOffspringMenu = GameObject.Find("InputNames");
     player            = GameObject.Find("Player").GetComponent <CharacterController>();
     //nutsAmountUI = GameObject.Find("NutsAmount").GetComponent<TextMeshProUGUI>();
     timerImage    = GameObject.Find("Timer").GetComponent <Image>();
     timerBorder   = GameObject.Find("TimerBorder").GetComponent <Image>();
     camObject     = GameObject.Find("Camera");
     PostProc      = GameObject.Find("Post-process Volume").GetComponent <PostProcessVolume>();
     camController = camObject.GetComponent <CameraController>();
     roundTimer    = roundLengthSeconds;
     //NameOffspringMenu.SetActive(false);
     SpawnHoles();
     cage = Object.Instantiate(tutorialCagePrefab, Vector3.zero, Quaternion.identity);
     clock.SetActive(false);
 }
コード例 #3
0
        /// <summary>
        /// Allows the page to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        private void OnUpdate(object sender, GameTimerEventArgs e)
        {
            GameTime gameTime = new GameTime(e.TotalTime, e.ElapsedTime);

            if (!Global.loaded && !Global.loading)
            {
                Global.loading = true;
                if (spriteBatch == null)
                {
                    spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);
                }
                LoadBar();
                Load(Deployment.Current.Dispatcher);
            }
            if (load != null && Global.loading)
            {
                load.Update(gameTime);
            }
            if (intro != null && !Global.loading)
            {
                if (scene.kind == Scene.LOAD)
                {
                    intro.Initialize();
                    action.Initialize();
                    editor.Initialize();
                    input.pad.Initialize();

                    SwitchScenes(Scene.INTRO);
                }
                input.Update();
                scene.Update(gameTime);
                if (scene.kind == Scene.INTRO)
                {
                    SwitchScenes(Scene.ACTION);
                }
            }
            fps = 1000 / e.ElapsedTime.Milliseconds;
        }