本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Texture2D.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.Count方法的具体用法?C# Texture2D.Count怎么用?C# Texture2D.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Texture2D
的用法示例。
在下文中一共展示了Texture2D.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadNpcCars
public void LoadNpcCars(World world, IList<Car> list, int quantity, Texture2D[] textures)
{
list.Clear(); //Delete any existing cars in operation
var rand = new Random();
var laneNum = 0;
for(var i = 0; i < quantity; i++)
{
var spawnAttempts = 0;
var textureId = rand.Next(0, textures.Count()-1);
var newCar = new Car(textures[textureId]);
world.InitializeNpcCar(newCar, laneNum, ref rand);
world.OptimizeSpawnPosition(this, list, newCar, laneNum, ref rand, ref spawnAttempts);
//If the car did not hit its number of maximum spawn attempts, assume it safe-spawned and spawn it
if(spawnAttempts <= World.MaxSpawnAttempts)
{
list.Add(newCar);
laneNum++;
if (laneNum >= world.Lanes.Count())
laneNum = 0;
}
}
}
示例2: ExplosionEngine
public ExplosionEngine(GraphicsDevice device, Texture2D[] explosionArray, int size, int smallSize)
{
_textureQuad = new TextureQuad(device, explosionArray, size, size);
_smallTextureQuad = new TextureQuad(device, explosionArray, smallSize, smallSize);
_explosionList = new List<Explosion>();
_maxIndex = explosionArray.Count();
_device = device;
}
示例3: Load
public void Load()
{
//jump, move, idle, attackL, attachH, attackA
textureSpeeds = new int[6] { 0, 1, 1, 3, 2, 0 };
for (int i = 1; i < textureSpeeds.Length; i++)
{
heroFrameSpeed.Add(textureNames[i, 0] + "Count", 0);
heroFrameSpeed.Add(textureNames[i, 0] + "Frame", 0);
}
//load all reg card textures into dictionary ~120 count...
//key ~ suit+number+state
for (int i = 1; i < 11; i++)
{
tempy = 0;
tempy2 = 0;
for (int x = 1; x < 13; x++)
{
if (tempy2 >= 3)
{
tempy++;
tempy2 = 0;
}
if (tempy >= 5)
{
tempy = 0;
}
regCards[cardTypes[tempy].ToString() + i.ToString() + cardStates[tempy2].ToString()] = Engine.GameContainer.Load<Texture2D>("Textures\\Animations\\Cards\\" + cardTypes[tempy].ToString() + "\\"
+ cardTypes[tempy].ToString() + i.ToString() + cardStates[tempy2].ToString());
tempy2++;
}
}
//load all reg card textures into dictionary ~36 count...
//key ~ suit+type+state
for (int i = 0; i < 4; i++)
{
tempy = 0;
tempy2 = 0;
for (int x = 0; x < 9; x++)
{
if (tempy2 >= 3)
{
tempy++;
tempy2 = 0;
}
if (tempy >= 5)
{
tempy = 0;
}
faceCards[cardTypes[i].ToString() + faceTypes[tempy].ToString() + cardStates[tempy2].ToString()] = Engine.GameContainer.Load<Texture2D>("Textures\\Animations\\Cards\\" + cardTypes[i].ToString() + "\\"
+ cardTypes[i].ToString() + faceTypes[tempy].ToString() + cardStates[tempy2].ToString());
tempy2++;
}
}
Texture2D[][] textureArray = new Texture2D[][] { //pass each array of textures into the array - same order as prev
heroJump, heroMove, heroIdle, heroAttackL, heroAttackH, heroAttackA,
rabbitMove, rabbitIdle,
caterpillarMove,
catIdle, catFadeIn, catFadeOut,
wormMove, wormAttack,
hatterIdle, hatterMove,
queenIdle, queenMove, queenPoint, queenStun, queenStunned
};
for (int i = 0; i < textureArray.Count(); i++)
{
int tempInt;
String tempString, tempString2;
tempInt = textureArray.Count(); // tempInt to texture array count
Texture2D tempHold; // tempArray to new Texture2D array with length element i array length
for (int x = 0; x < textureArray[i].Count(); x++) //loop until element i array length
{
tempString = textureNames[i, 0] + x.ToString(); //tempString to name of first string in i set
tempString2 = textureNames[i, 1]; //tempString2 to texture name of second string in i set
tempHold = Engine.GameContainer.Load<Texture2D>("Textures\\Animations\\" + tempString2.ToString() + "\\" + tempString.ToString()); //load texture into temp array
textureArray[i][x] = tempHold; //position x of element i array = tempArray texture
}
}
}
示例4: Load
public static void Load(ContentManager content)
{
Pixel = content.Load<Texture2D>("Art/Images/Misc/Pixel"); // Flecks Art Contribution.
// Load Sounds
Sound.Load(content);
// VIDEOS
StartVideo = content.Load<Video>("Art/Videos/IntroVideo");
TutVideo = content.Load<Video>("Art/Videos/TutVideo");
GameManager.videoPlayer = new VideoPlayer();
GameManager.videoPlayer.IsLooped = false;
Base = content.Load<Texture2D>("Art/Images/Misc/base");
Background = content.Load<Texture2D>("Art/Images/UI/background");
// Trenches
TrenchTexs = new Texture2D[16];
for (int i = 0; i < TrenchTexs.Count(); i++)
TrenchTexs[i] = content.Load<Texture2D>("Art/Images/Trenches/trench_" + i);
// Terrain
Concrete = content.Load<Texture2D>("Art/Images/Terrain/concrete");
ConcreteBlocked = content.Load<Texture2D>("Art/Images/Terrain/concreteBlocked");
GroundTexs = content.Load<Texture2D>("Art/Images/Terrain/new-grass");
BlockedSquare = content.Load<Texture2D>("Art/Images/Terrain/squareBlocked");
EnemyTex = content.Load<Texture2D>("Art/Images/Misc/ghostSquare");
// Towers
TowerGun = new Texture2D[4];
for (int i = 0; i < TowerGun.Length; i++)
TowerGun[i] = content.Load<Texture2D>("Art/Images/Towers/GunTower/minigun_lvl" + (i + 1) + "Turret");
TowerRocket = new Texture2D[4];
for (int i = 0; i < TowerRocket.Length; i++)
TowerRocket[i] = content.Load<Texture2D>("Art/Images/Towers/RocketTower/RocketTurretLvl" + (i + 1));
TowerSAM = new Texture2D[4];
for (int i = 0; i < TowerSAM.Length; i++)
TowerSAM[i] = content.Load<Texture2D>("Art/Images/Towers/SAMTower/SAMmk" + (i + 1));
TowerTesla = new Texture2D[4];
for (int i = 0; i < TowerTesla.Length; i++)
TowerTesla[i] = content.Load<Texture2D>("Art/Images/Towers/TeslaTower/teslatower-mk" + (i + 1));
//Enemies
TankBottom = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_bottom");
TankTop = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_top");
JeepBottom = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_bottom");
JeepTop = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_top");
Soldier = content.Load<Texture2D>("Art/Images/UnitsEnemy/soldier");
Helicopter = content.Load<Texture2D>("Art/Images/UnitsEnemy/helicopter");
Transport = content.Load<Texture2D>("Art/Images/UnitsEnemy/transport");
TankBottomBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_bottom_blue");
TankTopBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_top_blue");
TankBottomRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_bottom_red");
TankTopRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/Tank_top_red");
JeepBottomBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_bottom_blue");
JeepTopBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_top");
JeepTopRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_top");
JeepBottomRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/jeep_bottom_red");
SoldierBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/soldier_blue");
SoldierRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/soldier_red");
TransportBlue = content.Load<Texture2D>("Art/Images/UnitsEnemy/transport_blue");
TransportRed = content.Load<Texture2D>("Art/Images/UnitsEnemy/transport_red");
//Friendlies
FriendlySoldier = content.Load<Texture2D>("Art/Images/UnitsPlayer/army_man_good");
FriendlyMechanic = content.Load<Texture2D>("Art/Images/UnitsPlayer/mechanic");
// Projectiles
Projectile = content.Load<Texture2D>("Art/Images/Projectiles/Projectile");
ProjectileGun = content.Load<Texture2D>("Art/Images/Projectiles/bullet");
ProjectileRocket = content.Load<Texture2D>("Art/Images/Projectiles/missile");
ProjectileSAM = content.Load<Texture2D>("Art/Images/Projectiles/sam-missile");
ProjectileTesla = content.Load<Texture2D>("Art/Images/Projectiles/tesla-zappy");
// UI
uiUp = content.Load<Texture2D>("Art/Images/UI/ui-template-topbar");
uiSide = content.Load<Texture2D>("Art/Images/UI/ui-side");
ButtonsBase = new Texture2D[4];
for (int i = 0; i < 4; i++)
ButtonsBase[i] = content.Load<Texture2D>("Art/Images/UI/Buttons/ButtonBase" + i);
ButtonsTower = new Texture2D[5];
for (int i = 0; i < 5; i++)
ButtonsTower[i] = content.Load<Texture2D>("Art/Images/UI/Buttons/ButtonTower" + i);
ButtonsMisc = new Texture2D[1];
for (int i = 0; i < 1; i++)
ButtonsMisc[i] = content.Load<Texture2D>("Art/Images/UI/Buttons/ButtonMisc" + i);
HpBar = new Texture2D[2];
for (int i = 0; i < 2; i++)
HpBar[i] = content.Load<Texture2D>("Art/Images/UI/hpBar" + i);
//effects
BloodSplats = content.Load<Texture2D>("Art/Images/Effect/BLOOD");
Explosions = content.Load<Texture2D>("Art/Images/Effect/explosion-sprite");
ButtonEffectTexture = content.Load<Texture2D>("Art/Images/UI/Buttons/ButtonEffect");
tabTestTexture = content.Load<Texture2D>("Art/Images/UI/Buttons/tabTestTex");
//tab portraits
HitlerPort = content.Load<Texture2D>("Art/Images/Portraits/Hitler");
ChurchilPort = content.Load<Texture2D>("Art/Images/Portraits/Churchil");
//.........这里部分代码省略.........