Пример #1
0
        public override void Shutdown()
        {
            // 通知服务器客户端已离开
            var msg = this._client?.CreateGameMessage <ClientLeaveMessage>();

            this._client?.SendMessage(msg);
            this._board        = null;
            this._btnSurrender = null;
            this._btnBack      = null;
            this._gameHUD      = null;

            this._gameboard = null;

            this._connectTimer?.Stop();
            this._connectTimer?.Dispose();

            new Thread(() =>
            {
                // 防止客户端销毁时,消息还没能发送过去
                Thread.Sleep(10);
                this._client?.Shutdown();
            }).Start();
            PlayerType = PlayerState.None;

            base.Shutdown();
        }
Пример #2
0
        public override void Init()
        {
            this._btnSurrender = new Button(
                this._content.Load <Texture2D>("img\\button_surrender"),
                new Vector2(1440, 1290),
                new Vector2(144, 72));
            this._btnSurrender.Click += () =>
            {
                this._surrender = true;
            };
            this._btnBack = new Button(
                this._content.Load <Texture2D>("img\\button_back"),
                new Vector2(1726, 1290),
                new Vector2(144, 72));
            this._btnBack.Click += () =>
            {
                Reset();
                ScreenManager.GoBack();
            };

            this._btnSurrender.Init();
            this._btnBack.Init();

            this._gameHUD = new GameHUD();

            // GameBoard
            this._gameboard = new GameBoard(this._content, this);

            // AI
            this._ai   = new AI();
            PlayerType = PlayerState.Black;

            base.Init();
        }
Пример #3
0
        private void Initialize()
        {
            MapFullBounds = CreateMapFullBounds();
            VAdapterGame  = CreateViewport();
            VAdapterHUD   = CreateViewport();           // later perhaps diff adapters

            InternalBatch   = new SpriteBatch(Graphics.GraphicsDevice);
            FixedBatch      = new SpriteBatchWrapper(InternalBatch);
            TranslatedBatch = new SpriteBatchWrapper(InternalBatch);

            InputStateMan = new InputStateManager(VAdapterGame, VAdapterHUD, MapOffsetX, MapOffsetY);
            GameHUD       = CreateHUD();
            Background    = CreateBackground();

            Entities = CreateEntityManager();

            DebugDisp = new DummyDebugTextDisplay();

            GameHUD.Validate();

#if DEBUG
            FPSCounter = new RealtimeAPSCounter();
            UPSCounter = new RealtimeAPSCounter();
            GCMonitor  = new GCMonitor();

            DebugMap = CreateDebugMinimap();
#endif
        }
Пример #4
0
    void Start( )
    {
        //Initiate data
        GameService.InitDocument( );

        //Show the start game screen
        StartGameScreen.SetActive(true);   // ON
        InstructionScreen.SetActive(false);
        Marketplace.SetActive(false);
        PauseScreen.SetActive(false);
        GameHUD.SetActive(false);
        GameInfoHUD.SetActive(false);

        BtnLive.SetActive(false);
        BtnShop.SetActive(false);

        //Set initial values
        SocialLevel   = 0;
        VerbalLevel   = 0;
        SkillLevel    = 0;
        HardwareLevel = 0;

        Followers        = 0;
        Viewers          = 0;
        Money            = 60.00f;
        StreamerName     = "";
        TotalStreamTime  = 16.0f;
        StartCash        = 0;
        GameMessageList  = new List <KeyValuePair <string, string> >( );
        PlayerOwnedGames = new List <Game>( );

        //Set game state
        CurrentGameState = GameState.MENU;
        bGameStarted     = false;
    }
Пример #5
0
 /// <summary>
 /// Show Game instructions
 /// </summary>
 public void ShowInstructions( )
 {
     StartGameScreen.SetActive(false);
     InstructionScreen.SetActive(true);
     PauseScreen.SetActive(false);
     GameHUD.SetActive(false);
     GameInfoHUD.SetActive(false);
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     event_time   = Random.Range(5.0f, 30.0f);
     camera_shake = FindObjectOfType <CameraShake>();
     game_hud     = FindObjectOfType <GameHUD>();
     game_hud.SetEventText("");
     Debug.Log(event_time);
 }
Пример #7
0
 void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.name == "Ball")
     {
         string wallName = transform.name;
         GameHUD.Score(wallName);
         hitInfo.gameObject.SendMessage("RestartGame", 1.0f, SendMessageOptions.RequireReceiver);
     }
 }
Пример #8
0
        public ScoreDisplayManager(GameHUD hud, bool firstShow)
        {
            hud.AddElement(ScoreDisplay      = new ScoreDisplay(firstShow));
            hud.AddElement(MPScoreDisplay    = new MultiplayerScoreDisplay(firstShow));
            hud.AddElement(StarsScoreDisplay = new StarsScoreDisplay(firstShow));
            hud.AddElement(SCCMScoreDisplay  = new SCCMScoreDisplay(firstShow));

            FakeFirstUpdate();
        }
    protected override void Start()
    {
        //base.Start();
        _health = _maxHealth;
        InvokeRepeating("Resources", 1f, 1f);

        //healthBar = GetComponentInChildren<Image>();

        _hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <GameHUD>();
    }
Пример #10
0
 void Awake()
 {
     gameHUD       = (GameHUD)FindObjectOfType(typeof(GameHUD));
     selectObjects = (SelectObjects)FindObjectOfType(typeof(SelectObjects));
     gMode         = (GMode)FindObjectOfType(typeof(GMode));
     pController   = (PController)FindObjectOfType(typeof(PController));
     weaponPanel   = (WeaponPanel)FindObjectOfType(typeof(WeaponPanel));
     passivePanel  = (PassiveUnitPanel)FindObjectOfType(typeof(PassiveUnitPanel));
     units         = Unit.allUnits;
 }
Пример #11
0
 void Awake()
 {
     gameHUD        = (GameHUD)FindObjectOfType(typeof(GameHUD));
     character      = (Character)FindObjectOfType(typeof(Character));
     selectObjects  = (SelectObjects)FindObjectOfType(typeof(SelectObjects));
     runUnitManager = (RunUnitManager)FindObjectOfType(typeof(RunUnitManager));
     gMode          = (GMode)FindObjectOfType(typeof(GMode));
     pController    = (PController)FindObjectOfType(typeof(PController));
     gameCommands.Add("Red");
     gameCommands.Add("Blue");
 }
Пример #12
0
    void Awake()
    {
        #region singletonEnforcement
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
            Debug.Error("core", "Second GameHUD detected. Deleting gameOject.");
            return;
        }
        #endregion

        UIhud          = GameObject.Find("_UI");
        mainHUDCanvas  = GameObject.Find("mainHUD");
        worldMapCanvas = GameObject.Find("worldMapCanvas");
        gameMap        = GameObject.Find("mapBG");
        player         = GameObject.Find("_Player");
        testObjective  = GameObject.Find("TestObjective");
        if (!pauseMenu)
        {
            pauseMenu = GameObject.Find("pauseMenu");
        }
        pauseMenu.SetActive(false);

        //!Turn on UI stuff
        worldMapCanvas.SetActive(true);

        //!Fill mapLabels array
        mapLabels      = GameObject.FindGameObjectsWithTag("worldMapLabel");
        closeMapButton = GameObject.Find("CloseMapButton");
        closeMapButton.SetActive(false);

        //!Set mapcam reference
        mapCam = GameObject.Find("mapCam");
        //!Set compassCameraPoint reference
        compassCameraPoint = GameObject.Find("compassCameraPoint");
        compass            = GameObject.Find("compassSlider");
        slider             = compass.transform.FindChild("Handle Slide Area").gameObject;
        slider.SetActive(false);
        leftArrow = compass.transform.FindChild("leftArrow").gameObject;
        leftArrow.SetActive(false);
        rightArrow = compass.transform.FindChild("rightArrow").gameObject;
        rightArrow.SetActive(false);

        //!Set objective text reference
        objectiveText = GameObject.Find("objectiveText");

        phoneButtons = GameObject.Find("PhoneButtons");
        mapElements  = GameObject.Find("MapElements");
        mapElements.SetActive(false);
    }
Пример #13
0
    void Start()
    {
        gravity = Physics.gravity;

        GameObject obj = GameObject.FindGameObjectWithTag("GameUI");

        if (obj)
        {
            gameHUD = obj.GetComponent <GameHUD>();
        }
    }
Пример #14
0
    /// <summary>
    /// Show Game instructions
    /// </summary>
    public void ShowStartScreen( )
    {
        StartGameScreen.SetActive(true);
        InstructionScreen.SetActive(false);
        Marketplace.SetActive(false);
        PauseScreen.SetActive(false);
        GameHUD.SetActive(false);
        GameInfoHUD.SetActive(false);

        CurrentGameState = GameState.MENU;
    }
Пример #15
0
    // Use this for initialization
    void Start()
    {
        gameHUD         = GameObject.Find("HUD").GetComponent <GameHUD>();
        howToPlayScreen = gameHUD.GetComponentInChildren <HowToPlayScreen>();
        gameOverScreen  = gameHUD.GetComponentInChildren <GameOverScreen>();

        gameCamera = Camera.main.GetComponent <GameCamera>();

        AudioSource = GetComponent <AudioSource>();

        SoundManager.Instance.PlayGameMusic(GameDataManager.Instance.IsSound);
    }
Пример #16
0
 public void TestHUDMethods()
 {
     GameHUD HUD = new GameHUD();
     try{
         HUD.Start();
         HUD.OnGUI();
         HUD.Update();
     }catch(Exception e) {
         //Something went wrong
         Assert.True(false,"error "+e.ToString());
     }
 }
Пример #17
0
    /// <summary>
    /// Pause / unpause the game
    /// </summary>
    public void PauseGame( )
    {
        bGamePaused = !bGamePaused;

        StartGameScreen.SetActive(false);
        InstructionScreen.SetActive(false);
        PauseScreen.SetActive(bGamePaused);
        GameHUD.SetActive(!bGamePaused);
        GameInfoHUD.SetActive(!bGamePaused);

        CurrentGameState = bGamePaused ? GameState.PAUSE : GameState.GAME;
    }
Пример #18
0
    // Use this for initialization
    void Start()
    {
        gameHUD         = GetComponentInParent <GameHUD>();
        howToPlayScreen = GameObject.Find("How To Play Screen").GetComponent <HowToPlayScreen>();
        mainMenuScreen  = GameObject.Find("Main Menu Screen").GetComponent <MainMenuScreen>();
        creditsScreen   = GameObject.Find("Credits Screen").GetComponent <CreditsScreen>();

        // Title Screen Text
        pauseText = GetComponentInChildren <Text>();

        // Resume Button
        resume       = transform.Search("Resume Button").gameObject;
        resumeSprite = resume.GetComponent <Image>();
        resumeBtn    = resume.GetComponent <Button>();
        resumeText   = resumeBtn.GetComponentInChildren <Text>();
        resumeBtn.onClick.AddListener(ResumeClicked);

        // How to Play Button
        howToPlay       = transform.Search("How To Play Button").gameObject;
        howToPlaySprite = howToPlay.GetComponent <Image>();
        howToPlayBtn    = howToPlay.GetComponent <Button>();
        howToPlayText   = howToPlayBtn.GetComponentInChildren <Text>();
        howToPlayBtn.onClick.AddListener(HowToPlayClicked);

        // Sound Toggle Button
        sound          = transform.Search("Sound Button").gameObject;
        soundprite     = sound.GetComponent <Image>();
        soundBtn       = sound.GetComponent <Button>();
        soundText      = soundBtn.GetComponentInChildren <Text>();
        soundText.text = GameDataManager.Instance.IsSound ? SOUND_ON_TEXT : SOUND_OFF_TEXT;
        soundBtn.onClick.AddListener(SoundToggleClicked);

        // Credits Button
        credits       = transform.Search("Credits Button").gameObject;
        creditsSprite = credits.GetComponent <Image>();
        creditsBtn    = credits.GetComponent <Button>();
        creditsText   = creditsBtn.GetComponentInChildren <Text>();
        creditsBtn.onClick.AddListener(CreditsClick);

        // Quit Button
        quit       = transform.Search("Quit Button").gameObject;
        quitSprite = quit.GetComponent <Image>();
        quitBtn    = quit.GetComponent <Button>();
        quitText   = quitBtn.GetComponentInChildren <Text>();
        quitBtn.onClick.AddListener(QuitClicked);

        blanket = transform.Search("Blanket").GetComponent <Image>();

        ready = true;

        Hide();
    }
Пример #19
0
        public override void Shutdown()
        {
            this._board        = null;
            this._btnSurrender = null;
            this._btnBack      = null;
            this._gameHUD      = null;

            this._gameboard = null;
            this._ai        = null;
            PlayerType      = PlayerState.None;

            base.Shutdown();
        }
Пример #20
0
        public void TestHUDMethods()
        {
            GameHUD HUD = new GameHUD();

            try{
                HUD.Start();
                HUD.OnGUI();
                HUD.Update();
            }catch (Exception e) {
                //Something went wrong
                Assert.True(false, "error " + e.ToString());
            }
        }
Пример #21
0
        public static void AddViewWithData()
        {
            const int HEALTH_VALUE = 75;

            ViewManager.Instance.AddView(View.GameHUD, new GameHUD.GameHUDData(HEALTH_VALUE));
            Assert.IsTrue(ViewManager.Instance.IsViewActive(View.GameHUD));

            GameHUD   gameHUD         = GameObject.FindObjectOfType <GameHUD>();
            FieldInfo gameHUDDataInfo = gameHUD.GetType().GetField("gameHudData", BindingFlags.Instance | BindingFlags.NonPublic);

            GameHUD.GameHUDData internalDataObject = gameHUDDataInfo.GetValue(gameHUD) as GameHUD.GameHUDData;
            Assert.AreEqual(HEALTH_VALUE, internalDataObject.health);
        }
Пример #22
0
 // Use this for initialization
 void Start()
 {
     cameraScripts = Camera.main.GetComponent <CameraScripts>();
     playerHUD     = GameObject.Find("HUD").GetComponent <PlayerHUD>();
     gameHUD       = GameObject.Find("HUD").GetComponent <GameHUD>();
     initPositions();
     initCharacterList();
     character1 = characters[0];
     character2 = characters[1];
     character3 = characters[2];
     character4 = characters[3];
     selectAll();
 }
Пример #23
0
    /// <summary>
    /// Start game and go to game hud & screen
    /// </summary>
    public void StartGame( )
    {
        //show the game hud
        StartGameScreen.SetActive(false);
        InstructionScreen.SetActive(false);
        PauseScreen.SetActive(false);
        GameHUD.SetActive(true);     // ON
        GameInfoHUD.SetActive(true); // ON

        CurrentGameState = GameState.GAME;

        StartCoroutine(StartGameCallback( ));
    }
Пример #24
0
	void Awake() {
		#region singletonEnforcement
		if(instance == null) {
			instance = this;
		} else {
			Destroy(this.gameObject);
			Debug.Error("core", "Second GameHUD detected. Deleting gameOject.");
			return;
		}
		#endregion

        UIhud = GameObject.Find("_UI");
		mainHUDCanvas = GameObject.Find("mainHUD");
		worldMapCanvas = GameObject.Find("worldMapCanvas");
		gameMap = GameObject.Find("mapBG");
		player = GameObject.Find("_Player");
		testObjective = GameObject.Find("TestObjective");
        if (!pauseMenu)
        {
            pauseMenu = GameObject.Find("pauseMenu");
        }
		pauseMenu.SetActive (false);
		
		//!Turn on UI stuff
		worldMapCanvas.SetActive(true);

		//!Fill mapLabels array
		mapLabels = GameObject.FindGameObjectsWithTag("worldMapLabel");
		closeMapButton = GameObject.Find("CloseMapButton");
		closeMapButton.SetActive(false);

		//!Set mapcam reference
		mapCam = GameObject.Find("mapCam");
		//!Set compassCameraPoint reference
		compassCameraPoint = GameObject.Find("compassCameraPoint");
		compass = GameObject.Find("compassSlider");
		slider = compass.transform.FindChild ("Handle Slide Area").gameObject;
		slider.SetActive (false);
		leftArrow = compass.transform.FindChild ("leftArrow").gameObject;
		leftArrow.SetActive (false);
		rightArrow = compass.transform.FindChild ("rightArrow").gameObject;
		rightArrow.SetActive (false);

		//!Set objective text reference
		objectiveText = GameObject.Find("objectiveText");

		phoneButtons = GameObject.Find("PhoneButtons");
		mapElements = GameObject.Find("MapElements");
		mapElements.SetActive(false);

	}
Пример #25
0
    // Use this for initialization
    void Start()
    {
        gameHUD = GetComponentInParent <GameHUD>();

        slides = new Sprite[4] {
            ResourceManager.Instance.TutorialImageControls,
            ResourceManager.Instance.TutorialImageNoControls,
            ResourceManager.Instance.TutorialImageGrabbing,
            ResourceManager.Instance.TutorialImageHowToScore,
        };

        tutorialSlideOneGraphics   = GetComponentInChildren <TutorialSlideOne>();
        tutorialSlideTwoGraphics   = GetComponentInChildren <TutorialSlideTwo>();
        tutorialSlideThreeGraphics = GetComponentInChildren <TutorialSlideThree>();
        tutorialSlideFourGraphics  = GetComponentInChildren <TutorialSlideFour>();

        pauseScreen = GameObject.Find("Pause Screen").GetComponent <PauseScreen>();

        howToPlayText = transform.Search("How To Play Text").GetComponent <Text>();

        blanket = transform.Search("Blanket").GetComponent <Image>();

        displaySlide = transform.Search("Display Slide").GetComponent <Image>();

        GameObject nextSlide = transform.Search("Next Slide Button").gameObject;

        nextSlideBtn = nextSlide.GetComponent <Button>();
        nextSlideBtn.onClick.AddListener(NextSlide);
        nextSlideSprite = nextSlide.GetComponent <Image>();

        GameObject previousSlide = transform.Search("Previous Slide Button").gameObject;

        previousSlideBtn = previousSlide.GetComponent <Button>();
        previousSlideBtn.onClick.AddListener(PreviousSlide);
        previousSlideSprite = previousSlide.GetComponent <Image>();

        GameObject close = transform.Search("Close Button").gameObject;

        closeBtn = close.GetComponent <Button>();
        closeBtn.onClick.AddListener(Exit);
        closeSprite = close.GetComponent <Image>();

        slideBubble1 = transform.Search("Slide 1 Bubble").GetComponent <Image>();
        slideBubble2 = transform.Search("Slide 2 Bubble").GetComponent <Image>();
        slideBubble3 = transform.Search("Slide 3 Bubble").GetComponent <Image>();
        slideBubble4 = transform.Search("Slide 4 Bubble").GetComponent <Image>();

        ready = true;

        Hide();
    }
Пример #26
0
 void Awake()
 {
     #region Singleton
     if (s_Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     s_Instance = this;
     #endregion
     btnStartBattle.onClick.AddListener(OnStartBattle);
     btnRestart.onClick.AddListener(OnRestartLevel);
     btnContinue.onClick.AddListener(OnContinueLevel);
 }
Пример #27
0
    private void Awake()
    {
        s_Instance = this;

        m_LeaveOrEnterShipButton.onClick.AddListener(() =>
        {
            string labelStr = m_LeaveOrEnterShipButtonLabel.text;
            m_LeaveOrEnterShipButtonLabel.text = labelStr == "Leave Ship" ? "Enter Ship" : "Leave Ship";
            OnLeaveOrEnterShipButtonTapped?.Invoke();
        });
        m_LeaveOrEnterShipButton.gameObject.SetActive(false);

        Enemy.OnSuccessfullyHijacked += () => m_LeaveOrEnterShipButtonLabel.text = "Leave Ship";
    }
Пример #28
0
        public override void Init()
        {
            this._surrender             = false;
            this._connected             = false;
            this._connectTime           = 0;
            this._connectTimer          = new Timer(100);
            this._connectTimer.Elapsed += Timer_Elapsed;

            this._btnSurrender = new Button(
                this._content.Load <Texture2D>("img\\button_surrender"),
                new Vector2(1440, 1290),
                new Vector2(144, 72));
            this._btnSurrender.Enabled = false;
            this._btnSurrender.Click  += () =>
            {
                this._surrender = true;
            };
            this._btnBack = new Button(
                this._content.Load <Texture2D>("img\\button_back"),
                new Vector2(1726, 1290),
                new Vector2(144, 72));
            this._btnBack.Click += () =>
            {
                Reset();
                ScreenManager.GoBack();
            };

            this._btnSurrender.Init();
            this._btnBack.Init();

            this._gameHUD = new GameHUD();

            // GameBoard
            this._gameboard = new GameBoard(this._content, this);

            // 网络客户端
            this._client = new NetworkClient();
            this._client.Start();
            //this._client.Connect();
            this._client.DiscoverPeers();
            this._connectTimer.Start();
            CurrentPlayerState = PlayerState.None;
            PlayerType         = PlayerState.None;
            this._gameStatus   = "正在寻找服务器...";

            base.Init();
        }
Пример #29
0
        public LevelState(string name, int startLevel)
            : base(name)
        {
            Camera = new FirstPersonCamera();
            Camera.BoundingRadius = 2.0f;
            Camera.UpdateBoundingVolumes();

            YnG.ShowMouse = (GameConfiguration.EnabledMouse ? true : false);
            YnG.AudioManager.SoundEnabled = GameConfiguration.EnabledSound;
            YnG.AudioManager.MusicVolume  = GameConfiguration.MusicVolume;

            groundPlayerBoundingSphere = new BoundingSphere(Camera.Position, Camera.BoundingRadius);

            _mazeLevel = new MazeLevel(startLevel);
            Add(_mazeLevel);

            _gameHUD = new GameHUD();

            timeTimer = new MazeTimer();

            score = new Score(startLevel);

            gameState        = MazeGameState.Playing;
            elapsedPartyTime = 0;

            soundTimer = new YnTimer(1000, 0);

            if (YnG.AudioManager.SoundEnabled)
            {
                soundTimer.Completed += (s, e) => YnG.AudioManager.SoundEnabled = true;
            }
            else
            {
                soundTimer.Completed += (s, e) => { }
            };

            control = new MazeController(Camera);

            Scene.SceneLight.AmbientIntensity                      = 0.85f;
            Scene.SceneLight.DirectionalLights[0].Enabled          = true;
            Scene.SceneLight.DirectionalLights[0].Direction        = new Vector3(-1, 0.75f, -1);
            Scene.SceneLight.DirectionalLights[0].DiffuseColor     = Color.WhiteSmoke.ToVector3();
            Scene.SceneLight.DirectionalLights[0].DiffuseIntensity = 1.0f;
            Scene.SceneLight.DirectionalLights[0].SpecularColor    = new Vector3(233, 33, 33);
        }
Пример #30
0
    private IEnumerator LateStart()
    {
        yield return(new WaitForSeconds(0.001f));

        MainGame.SetActive(false);
        GameHUD.SetActive(false);
        HeroTutorial.SetActive(false);
        HeroHUD.SetActive(false);
        for (int i = 0; i < HeroInstructions.Length - 1; ++i)
        {
            HeroInstructions[i].SetActive(false);
        }
        MechanicsList.SetActive(false);
        for (int i = 0; i < Mechanics.Length - 1; ++i)
        {
            Mechanics[i].SetActive(false);
        }
    }
Пример #31
0
    void Start()
    {
        this.control1 = this.player1.GetComponent <PlayerController>();
        this.control2 = this.player2.GetComponent <PlayerController>();

        this.control1.numberPlayer = 1;
        this.control2.numberPlayer = 2;

        this.hudScript    = this.hud.GetComponent <GameHUD>();
        this.srBackground = this.background.GetComponent <SpriteRenderer>();
        int imageNum = Random.Range(0, backgroundsImages.Length);

        //Debug.Log(imageNum.ToString());
        if (imageNum == 0)
        {
            this.srBackground.GetComponent <Animator>().enabled = true;
        }
        this.srBackground.sprite = this.backgroundsImages[imageNum];
    }
Пример #32
0
    private void Awake()
    {
        ResetTimer();

        setHold = false;

        values.level        = values.startingLevel;
        values.linesCleared = 0;
        values.score        = 0;

        AudioManager.instance = FindObjectOfType <AudioManager>();
        hUD = FindObjectOfType <GameHUD>();

        cameraMovement = FindObjectOfType <Camera>().GetComponent <DynamicCameraMovement>();

        // Initialize the piece queue.
        pieceQueue = new Queue <int>();

        SevenBagGenerator();
    }
Пример #33
0
 void Awake()
 {
     instance = this;
     Application.runInBackground = true;
 }
Пример #34
0
 void Start()
 {
     GameObject gameHUDObject = GameObject.Find("HUD");
     gameHUD = gameHUDObject.GetComponent<GameHUD>();
 }
Пример #35
0
 void Start()
 {
     Instance = this;
 }
Пример #36
0
    void Awake()
    {
        player = GameObject.Find ("_Player");
        if (player) {
            qm = player.GetComponent<QuestManager>();
        }
        else {
            Debug.Error("ui","QuestManagerUI Script attached to 'QuestManager' object could not find a player in the scene!");
        }
        if (!questContainer) {
            Debug.Error("ui","QuestManagerUI Script attached to 'QuestManager' object could not find a child GameObject called 'Quests' the prefab connection could be broken.");
        }
        moreQuestInfo = transform.FindChild ("MoreQuestInfo").gameObject;
        if (!moreQuestInfo) {
            Debug.Error ("ui","QuestManagerUI script could not find the child object called 'MoreQuestInfo' the prefab may be broken");
        }
        moreQuestInfoTitle = moreQuestInfo.transform.FindChild ("QuestTitle").GetComponent<Text> ();
        if (!moreQuestInfoTitle) {
            Debug.Error ("ui","QuestManagerUI script could not find the child object called 'QuestTitle' the prefab may be broken");
        }
        moreQuestInfoDescription = moreQuestInfo.transform.FindChild ("ScrollView").transform.FindChild ("QuestDescription").GetComponent<Text> ();
        if (!moreQuestInfoDescription) {
            Debug.Error ("ui","QuestManagerUI script could not find the child object called 'QuestDescription' the prefab may be broken");
        }
        mainScrollbar = transform.FindChild("MainScrollbar").GetComponent<Scrollbar>();
        if(!mainScrollbar){
            Debug.Error ("ui","QuestManagerUI script could not find the child object called 'MainScrollbar' the prefab may be broken");
        }
        moreInfoScrollbar = transform.FindChild("MoreQuestInfo").FindChild("MoreQuestInfoScrollbar").GetComponent<Scrollbar>();
        if(!moreInfoScrollbar){
            Debug.Error ("ui","QuestManagerUI script could not find the child object called 'MoreQuestInfoScrollbar' the prefab may be broken");
        }
        theEventSystem = GameObject.Find ("EventSystem").GetComponent<EventSystem>();
        if(!theEventSystem){
            Debug.Error("ui","QuestManagerUI script could not find the EventSystem in the scene. Make sure the scene has an EventSystem");
        }
        gameHUD = GameObject.Find ("_HUDManager").GetComponent<GameHUD> ();
        if (!gameHUD) {
            Debug.Error("ui","Could not find the 'GameHUD' script on the '_HUDManager' GameObject in the scene: " + Application.loadedLevelName);
        }
        questButton = questUI.GetComponent<Button> ();
        buttonHeight = questButton.GetComponent<RectTransform> ().sizeDelta.y;

        theLists = new List<Quest>[3];
    }
Пример #37
0
 void Awake()
 {
     // Fetch the instance of the game class
     GameObject scripts = GameObject.Find("Scripts");
     game = (Game) scripts.GetComponent(typeof(Game));
     GameObject gameHUDObject = GameObject.Find("HUD");
     gameHUD = gameHUDObject.GetComponent<GameHUD>();
 }
Пример #38
0
 private GameHUD getGameHUD()
 {
     PlayerCounter playerCounter = (PlayerCounter)FindObjectOfType (typeof(PlayerCounter));
     gameHUD = new GameHUD (playerCounter, worldManager.getLevelData ().useTutorial);
     gameHUD.showSandboxTip=GameSettings.sandboxEnabled;
     return gameHUD;
 }
Пример #39
0
    void Start()
    {
        //player = GameObject.FindGameObjectWithTag ("Player");
        worldManager = (WorldManager)FindObjectOfType (typeof(WorldManager));
        player = worldManager.getPlayer ();

        escIsEnabled = true;
        setResume ();

        pauseMenu = getPauseMenu ();
        sandboxMenu = getSandboxMenu ();
        endLevelMenu = getEndLevelMenu ();
        gameHUD = getGameHUD ();
    }
Пример #40
0
 void Awake()
 {
     gameData = GameObject.FindObjectOfType<GameData>();
     gameHUD = GameObject.FindObjectOfType<GameHUD>();
     musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();
 }
Пример #41
0
    void Start()
    {
        gameMessages = new List<KeyValuePair<float, string>>(10);

        ammoTextures = new Dictionary<Weapon_AmmoType, Texture>()
        {
            {Weapon_AmmoType.RifleAmmo, Resources.Load<Texture>("textures/ui/rifle_ammo")},
        };

        castleTexture = Resources.Load<Texture>("textures/castle");
        castleDestroyedTexture = Resources.Load<Texture>("textures/castle_dest");
        solidTexture = Resources.Load<Texture>("textures/solid");
        crosshairTexture = Resources.Load<Texture>("textures/crosshair");
        healthTexture = Resources.Load<Texture>("textures/ui/health_icon");
        ammoTexture = Resources.Load<Texture>("textures/ui/ammo_icon");
        cashTexture = Resources.Load<Texture>("textures/ui/cash_icon");

        instance = this;
    }
Пример #42
0
 void Awake()
 {
     script = this;
 }
Пример #43
0
 void Start()
 {
     explosionPrefab = Explosion;
     info = GetComponent<WaitingScreen>();
     info.enabled = false;
     pause = GetComponent<MenuKeysController>();
     pause.enabled = false;
     hud = GetComponent<GameHUD>();
     hud.enabled = false;
     end = GetComponent<EndGame>();
     end.enabled = false;
     alpha = GetComponent<AlphaBackground>();
     alpha.enabled = false;
 }