当前位置: 首页>>代码示例>>C#>>正文


C# HUD类代码示例

本文整理汇总了C#中HUD的典型用法代码示例。如果您正苦于以下问题:C# HUD类的具体用法?C# HUD怎么用?C# HUD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HUD类属于命名空间,在下文中一共展示了HUD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddHudModButton

        public void AddHudModButton(HUD hud)
        {
            _hud = hud;

            Panel buttonPanel = (Panel)HudPanelField.GetValue(hud);

            Button helpButton;
            if (!buttonPanel.FindControlRecursive(out helpButton, b => b.Text == "Help"))
                return;

            Button modsButton = new Button(buttonPanel.Manager);
            modsButton.Init();
            SkinLayer skinLayer = modsButton.Skin.Layers["Control"];
            modsButton.Text = "Mods";
            modsButton.Width = (int)skinLayer.Text.Font.Resource.MeasureString(modsButton.Text).X + skinLayer.ContentMargins.Horizontal + 1;
            modsButton.ToolTip.Text = "Show information about and settings for mods";
            modsButton.Margins = new Margins(4, 4, 4, 4);
            modsButton.Click += ModsButtonOnClick;
            modsButton.Left = helpButton.Left;
            buttonPanel.Add(modsButton);

            helpButton.Left = modsButton.Left + modsButton.Width + modsButton.Margins.Right + helpButton.Margins.Left;

            buttonPanel.Width = helpButton.Left + helpButton.Width;
            buttonPanel.Left = (hud.Width - buttonPanel.Width) / 2;
        }
开发者ID:Gnomodia,项目名称:Gnomodia,代码行数:26,代码来源:ModDialog.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        hud = GameObject.FindGameObjectWithTag("Player").GetComponent<HUD>();
        topTen = GameObject.FindGameObjectWithTag("HighScore");
        hsText = topTen.GetComponent<Text>();
        finish = GameObject.FindGameObjectWithTag("Finish");
        fScript = finish.GetComponent<Finish>();
        scoreObj = GameObject.FindGameObjectWithTag("TopTen");
        hsOverlay = GameObject.Find("HSimage");
        screen = GameObject.FindGameObjectWithTag("ScreenOverlay");
        hsButton = GameObject.Find("HSButton").GetComponent<Button>();

        tempScore = 0;

        hsDone = false;

        highScore = new int[10];
        highScore[0] = 50000;
        highScore[1] = 25000;
        highScore[2] = 10000;
        highScore[3] = 5000;
        highScore[4] = 2500;
        highScore[5] = 1250;
        highScore[6] = 1000;
        highScore[7] = 500;
        highScore[8] = 125;
        highScore[9] = 50;
    }
开发者ID:daanlevendig,项目名称:Kinect_Run_v2,代码行数:29,代码来源:Highscores.cs

示例3: Start

	void Start(){
		sc  = GetComponent<ScoreScript> ();
		hud = GameObject.Find ("HUD").GetComponent<HUD>();
		hud.nRecord = sc.GetRecord ();
		hud.nScore  = sc.GetScore ();
		sc.ResetScore (); //zera os pontos
	}
开发者ID:pokyunn,项目名称:TG_WaterFall,代码行数:7,代码来源:GameOverScripts.cs

示例4: Start

	/*** ------------------------------------------------------ ***/
	/*** Game Engine methods, all can be overridden by subclass ***/
	/*** ------------------------------------------------------ ***/

	void Start () {
		hud = GetComponentInChildren< HUD >();
		
		// Init resources
		AddStartResourceLimits();
		AddStartResources();
	}
开发者ID:MaximeKestemont,项目名称:RTS_game,代码行数:11,代码来源:Player.cs

示例5: ChangeHUD

    void ChangeHUD(HUD hud, Rect view, Vector3 pos, Vector2 dim)
    {
        //float width = dim.x;
        //float height = dim.y;

        foreach (Transform _trans in hud.transform)
        {
            _trans.gameObject.layer = hud.gameObject.layer;

            if (_trans.tag == "MainCamera")
            {
                _trans.camera.cullingMask = 1 << (9 + (hud.HudNumber-1) );    // int represents layer number // ex:  1 | 1 << (9+num); // layer 1 + layer 9
                _trans.camera.rect = view;
                _trans.position = new Vector3((hud.HudNumber-1)*10, -10, 0);
            }
        //			if (_trans.tag == "CrossHair")
        //			{
        //				//_trans.position = pos;
        //				Rect inset = _trans.guiTexture.pixelInset;
        //				_trans.guiTexture.pixelInset = new Rect (inset.x, inset.y, width, height);
        //			}
            if (_trans.name == "Weapons")
            {
                foreach (Transform _t in _trans)
                {
                    _t.gameObject.layer = hud.gameObject.layer;
                }
            }
        }

        GameLoaded = true;
    }
开发者ID:SeniorTeam,项目名称:MonkeyHead,代码行数:32,代码来源:Game.cs

示例6: addCamera

    public void addCamera(Camera camera, HUD hud)
    {
        SplitPair pair = new SplitPair(camera, hud);

        Canvas hudCanvas = hud.GetComponent<Canvas>();
        hudCanvas.worldCamera = camera;

        if (topLeft == null) {
            topLeft = pair;
        } else if (botLeft == null) {
            botLeft = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP);
            SetOrientation(botLeft, SplitHelper.Orientation.BOTTOM);
        } else if (topRight == null) {
            topRight = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP_LEFT);
            SetOrientation(topRight, SplitHelper.Orientation.TOP_RIGHT);
        } else if (botRight == null) {
            botRight = pair;
            SetOrientation(botLeft, SplitHelper.Orientation.BOT_LEFT);
            SetOrientation(botRight, SplitHelper.Orientation.BOT_RIGHT);
        } else {
            Debug.Log("WARNING: Too many cameras, SplitHelper only supports 4 cameras");
        }
    }
开发者ID:Chaosed0,项目名称:foxstar,代码行数:25,代码来源:SplitHelper.cs

示例7: Awake

	void Awake() {
		sm = SimulationManager.sharedSimManager;
		sm.Hud = this;

		hud = GetComponent<HUD>();
		hudView = GetComponent<HUDView>();
	}
开发者ID:FIU-SCIS-Senior-Projects,项目名称:SmartBuilding4,代码行数:7,代码来源:HUDController.cs

示例8: EnemyCollisionTest

        public Tuple<int, bool> EnemyCollisionTest(Luigi luigi, HUD hud, IList<IEnemy> enemies, int x, SoundEffects sound)
        {
            Rectangle luigiRectangle = myLuigi.GetRectangle();
            Rectangle enemyRectangle;
            bool enemyKilled = false;
            bool invincible = myLuigi.Invincible();
            int xpos = x;
            Rectangle intersectionRectangle;
            Queue<IEnemy> doomedEnemies = new Queue<IEnemy>();

            foreach (IEnemy enemy in enemies)
            {

                enemyRectangle = enemy.GetRectangle();
                intersectionRectangle = Rectangle.Intersect(luigiRectangle, enemyRectangle);

                if (!intersectionRectangle.IsEmpty)
                {

                    if (intersectionRectangle.Width >= intersectionRectangle.Height)
                    {
                        sound.Bump();
                        doomedEnemies.Enqueue(enemy);
                        hud.luigiEnemyKill(luigi);
                        enemyKilled = true;
                    }
                    else if (invincible)
                    {
                        doomedEnemies.Enqueue(enemy);
                    }
                    else
                    {
                        myLuigi.Hit();
                        if (luigiRectangle.X < enemyRectangle.X)
                        {
                            xpos = xpos - intersectionRectangle.Width;
                        }
                        else
                        {
                            xpos = xpos + intersectionRectangle.Width;

                        }
                        if (myLuigi.IsDead())
                        {
                            hud.lifeLostLuigi();
                        }
                    }

                }
            }

            while (doomedEnemies.Count() > 0)
            {
                IEnemy enemie = doomedEnemies.Dequeue();
                enemies.Remove(enemie);
            }

            return new Tuple<int,bool>(xpos, enemyKilled);
        }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:59,代码来源:LuigiEnemyCollision.cs

示例9: ItemCollisionTest

        public void ItemCollisionTest(SoundEffects sound, HUD hud, IList<IItem> items)
        {
            Rectangle luigiRectangle = myLuigi.GetRectangle();
            Rectangle itemRectangle;
            Rectangle intersectionRectangle;
            Queue<IItem> doomedItems = new Queue<IItem>();
            foreach (IItem item in items)
            {
                itemRectangle = item.GetRectangle();
                intersectionRectangle = Rectangle.Intersect(luigiRectangle, itemRectangle);
                if (!intersectionRectangle.IsEmpty)
                {
                    // todo
                    switch (item.GetItemName())
                    {
                        case "Coin":
                            //myLuigi.Coin();
                            hud.addCoinLuigi();
                            hud.increaseScoreLuigi(Constants.coinValue);
                            hud.achievements.CoinGet();
                            break;
                        case "Mushroom":
                            sound.Powerup();
                            myLuigi.Mushroom();
                            hud.increaseScoreLuigi(Constants.mushroomValue);
                            hud.achievements.MushroomGet();
                            break;
                        case "Fireflower":
                            sound.Powerup();
                            myLuigi.Fireflower();
                            hud.increaseScoreLuigi(Constants.fireflowerValue);
                            hud.achievements.FlowerGet();
                            break;
                        case "Oneup":
                            sound.OneUp();
                            hud.extraLifeLuigi();
                            hud.increaseScoreLuigi(Constants.oneUpValue);
                            break;
                        case "Star":
                            sound.Powerup();
                            myLuigi.Star();
                            hud.increaseScoreLuigi(Constants.starValue);
                            hud.achievements.StarGet();
                            break;
                        default:
                            // nothing
                            break;
                    }
                    doomedItems.Enqueue(item);

                }
            }
            while (doomedItems.Count() > 0)
            {
                IItem item = doomedItems.Dequeue();
                items.Remove(item);

            }
        }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:59,代码来源:LuigiItemCollision.cs

示例10: AddHUDSprite

 public void AddHUDSprite(HUD hud)
 {
     GameObject tmp = GameObject.CreatePrimitive(PrimitiveType.Plane);
     tmp.name = "_HUDSprite";
     HUDSprite sprite = (HUDSprite)tmp.AddComponent("HUDSprite");
     sprite.hud = hud;
     this.AddSprite(sprite);
 }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:8,代码来源:GUIHandler.cs

示例11: Hit

 public void Hit(IList<IItem> items, bool isMario, bool isBig, HUD hud, SoundEffects sound)
 {
     if (isBig)
     {
         sound.BreakBlock();
         hud.increaseScoreMario(Constants.brokenBrickValue);
         GreenBrickSprite = null;
     }
 }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:9,代码来源:GreenBrick.cs

示例12: Awake

    void Awake()
    {
        _Game = GameObject.Find("Game");
        c_Game = _Game.GetComponent<Game>();

        c_Hud = transform.parent.GetComponent<HUD>();

        StartCoroutine( Init() );
    }
开发者ID:SeniorTeam,项目名称:MonkeyHead,代码行数:9,代码来源:Damage.cs

示例13: GamePlayScreen

        public GamePlayScreen(Game1 game)
        {
            this.game = game;

            hud = new HUD();
            hud.Font = game.Content.Load<SpriteFont>("Arial");

            LoadContent();
        }
开发者ID:WINPROG20142015,项目名称:CockBlockDefense,代码行数:9,代码来源:GamePlayScreen.cs

示例14: Start

    // Use this for initialization
    void Start()
    {
        m_HUD = FindObjectOfType<HUD>();

        m_WaveManager = FindObjectOfType<WaveManager>();
        m_WaveManager.gameObject.SetActive (false);

        m_Player = FindObjectOfType<PlayerInput>();
    }
开发者ID:Meetic666,项目名称:Fuel-Space-Invaders,代码行数:10,代码来源:GameManager.cs

示例15: Start

    void Start()
    {
        hud = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<HUD>();
        possessParticles = transform.FindChild("Particles_Possess").gameObject.GetComponent<ParticleSystem>();
        followParticles = transform.FindChild("Particles_Follow").gameObject.GetComponent<ParticleSystem>();

        possessParticles.enableEmission = false;
        followParticles.enableEmission = false;
    }
开发者ID:BrendanLoBuglio,项目名称:Caldera,代码行数:9,代码来源:PhantomController.cs


注:本文中的HUD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。