本文整理汇总了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;
}
示例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;
}
示例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
}
示例4: Start
/*** ------------------------------------------------------ ***/
/*** Game Engine methods, all can be overridden by subclass ***/
/*** ------------------------------------------------------ ***/
void Start () {
hud = GetComponentInChildren< HUD >();
// Init resources
AddStartResourceLimits();
AddStartResources();
}
示例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;
}
示例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");
}
}
示例7: Awake
void Awake() {
sm = SimulationManager.sharedSimManager;
sm.Hud = this;
hud = GetComponent<HUD>();
hudView = GetComponent<HUDView>();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
}
示例12: Awake
void Awake()
{
_Game = GameObject.Find("Game");
c_Game = _Game.GetComponent<Game>();
c_Hud = transform.parent.GetComponent<HUD>();
StartCoroutine( Init() );
}
示例13: GamePlayScreen
public GamePlayScreen(Game1 game)
{
this.game = game;
hud = new HUD();
hud.Font = game.Content.Load<SpriteFont>("Arial");
LoadContent();
}
示例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>();
}
示例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;
}