本文整理汇总了C#中GameController.Add方法的典型用法代码示例。如果您正苦于以下问题:C# GameController.Add方法的具体用法?C# GameController.Add怎么用?C# GameController.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameController
的用法示例。
在下文中一共展示了GameController.Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enemy
public Enemy(string modelname, GameController game, Vector3 pos, string texturename, Vector4 color, float hp, float damage, float speed, float acceleration, float attackDelay, float rotationSpeed)
: base(game)
{
this.game = game;
this.pos = pos;
this.texturename = texturename;
this.modelname = modelname;
type = GameObjectType.Enemy;
getSizeRatioAndTransformation();
// Stats
this.hp = hp;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = speed;
movementSpeedDefault = movementSpeed;
this.acceleration = acceleration;
this.maxAttackDelay = attackDelay;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = rotationSpeed;
this.attackingAngle = Constants.attackingAngle;
timeInBetweenShots = 2000;
// Gamelogic
isCollidable = true;
isAffectedByVortex = true;
// Model
colorDefault = color;
this.color = colorDefault;
refreshModel(this.color);
game.Add(this);
}
示例2: Player
public Player(GameController game, Vector3 pos)
: base(game)
{
this.game = game;
this.pos = pos;
type = GameObjectType.Player;
setStats();
// Add to game
game.Add(this);
}
示例3: Minion
public Minion(God obj, GameController game, string modelname, string texturename, Vector4 color, float hp, float damage, float speed, float acceleration, float attackDelay)
: base(game)
{
this.game = game;
this.master = obj;
this.pos = obj.pos;
this.texturename = texturename;
this.modelname = modelname;
type = GameObjectType.Boss;
getSizeRatioAndTransformation();
// Stats
this.hp = hp;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = speed;
this.movementSpeedDefault = movementSpeed;
this.acceleration = acceleration;
this.maxAttackDelay = attackDelay;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = Constants.playerRotationSpeed;
this.attackingAngle = Constants.attackingAngle;
timeInBetweenShots = 500;
// Gamelogic
isCollidable = true;
// Model
colorDefault = color;
this.color = colorDefault;
refreshModel(this.color);
// Randomise position
this.accX = acceleration * ((float)Math.Cos(game.player.rotationAngle));
this.accY = acceleration * ((float)Math.Sin(game.player.rotationAngle));
this.pos_offset_x = ((float)game.random.NextDouble() * this.mass * 10 - this.mass * 5);
this.pos_offset_y = ((float)game.random.NextDouble() * this.mass * 10 - this.mass * 5);
this.pos.X += pos_offset_x;
this.pos.Y += pos_offset_y;
// MISC
isAffectedByVortex = true;
game.Add(this);
}
示例4: field
public field(GameController game)
: base(game)
{
this.game = game;
this.maxUnits = game.player.fieldLevel * 15;
this.pos = game.player.pos;
this.texturename = null;
this.modelname = Constants.model_cube;
type = GameObjectType.FieldPlayer;
getSizeRatioAndTransformation();
// Stats
this.hp = 1;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = 0;
this.acceleration = 0;
this.maxAttackDelay = 10000;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = Constants.godRotationSpeed;
this.attackingAngle = Constants.attackingAngle;
// Gamelogic
isCollidable = false;
colossal = true;
// Model
this.colorDefault = Constants.blue;
this.color = this.colorDefault;
refreshModel(this.colorDefault);
// make initial minions
fieldUnits = new fieldUnit[maxUnits];
for (int i = 0; i < maxUnits; i++)
{
fieldUnits[i] = new fieldUnit(this, game, modelname, texturename, color, 100, 15, 100f, 60f, 50);
units++;
}
// MISC
isAffectedByVortex = false;
colossal = true;
game.Add(this);
}
示例5: God
public God(int maxMinions, GameController game, Vector3 pos, string modelname, string texturename, Vector4 color, float hp, float damage, float attackDelay)
: base(game)
{
this.maxMinions = maxMinions;
this.game = game;
this.pos = pos;
this.texturename = texturename;
this.modelname = modelname;
type = GameObjectType.Boss;
getSizeRatioAndTransformation();
// Stats
this.hp = hp;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = 7f;
this.acceleration = 7f;
this.maxAttackDelay = attackDelay;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = Constants.godRotationSpeed;
this.attackingAngle = Constants.attackingAngle;
timeInBetweenShots = 500;
// Gamelogic
isCollidable = true;
// Model
this.colorDefault = color;
this.color = this.colorDefault;
refreshModel(this.colorDefault);
// make initial minions
for (int i = 0; i < maxMinions; i++)
{
new Minion(this, game, modelname, null, Methods.getRandomColor(3), hp/3, damage/3, movementSpeed, acceleration, 400);
minions++;
}
// MISC
isAffectedByVortex = false;
colossal = true;
game.Add(this);
}
示例6: MirrorPlayer
public MirrorPlayer(GameController game)
: base(game)
{
this.game = game;
// Model
this.colorDefault = Constants.noColor;
this.color = colorDefault;
this.texturename = null;
this.modelname = Constants.model_fish;
getSizeRatioAndTransformation();
this.type = GameObjectType.MirrorPlayer;
// Stats
hp = game.player.hp;
mass = hp / size_ratio;
maxAttackDelay = 0;
maxHitDelay = 0;
maxRotationSpeed = Constants.playerRotationSpeed;
attackingAngle = Constants.attackingAngle;
timeInBetweenShots = 100;
this.pos = game.player.pos;
this.movementSpeed = game.player.movementSpeed;
this.acceleration = game.player.acceleration;
this.accX = acceleration * ((float)Math.Cos(game.player.rotationAngle));
this.accY = acceleration * ((float)Math.Sin(game.player.rotationAngle));
this.pos_offset_x = ((float)game.random.NextDouble() * this.mass * 10 - this.mass*5);
this.pos_offset_y = ((float)game.random.NextDouble() * this.mass * 10 - this.mass * 5);
this.pos.X = game.player.pos.X + pos_offset_x;
this.pos.Y = game.player.pos.Y + pos_offset_y;
this.damage = game.player.damage/2;
// Gamelogic
isCollidable = false;
refreshModel(color);
// Follow a target
target = null;
game.Add(this);
}
示例7: EnemySurvival
public EnemySurvival(string modelname, GameController game, Vector3 pos, string texturename, Vector4 color, float hp, float damage, float speed, float accX, float accY)
: base(game)
{
this.game = game;
this.pos = pos;
this.texturename = texturename;
this.modelname = modelname;
this.type = GameObjectType.EnemySurvival;
getSizeRatioAndTransformation();
// Stats
this.hp = hp;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = speed;
this.acceleration = acceleration;
this.maxAttackDelay = 1000;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = Constants.enemySurvivalRotationSpeed;
this.attackingAngle = (float)Math.PI;
// Model
colorDefault = color;
this.color = colorDefault;
refreshModel(this.color);
// Gamelogic
isCollidable = true;
// Movement dir
this.accX = accX;
this.accY = accY;
// Life time
lifeTime = 30000; // 30 seconds
// MISC
isAffectedByVortex = false;
game.Add(this);
}
示例8: fieldUnit
public fieldUnit(field obj, GameController game, string modelname, string texturename, Vector4 color, float hp, float damage, float speed, float acceleration, float attackDelay)
: base(game)
{
this.game = game;
this.master = obj;
this.pos = obj.pos;
this.texturename = texturename;
this.modelname = modelname;
type = GameObjectType.FieldPlayer;
getSizeRatioAndTransformation();
// Stats
this.hp = hp;
mass = hp / size_ratio;
massDefault = mass;
this.damage = damage;
this.movementSpeed = speed;
this.movementSpeedDefault = movementSpeed;
this.acceleration = acceleration;
this.maxAttackDelay = attackDelay;
this.maxHitDelay = Constants.enemyHitDelay;
this.maxRotationSpeed = Constants.playerRotationSpeed;
this.attackingAngle = Constants.attackingAngle;
// Gamelogic
isCollidable = false;
// Model
colorDefault = color;
this.color = colorDefault;
refreshModel(this.color);
// Randomise position
this.accX = acceleration * ((float)Math.Cos(game.player.rotationAngle));
this.accY = acceleration * ((float)Math.Sin(game.player.rotationAngle));
// MISC
isAffectedByVortex = true;
colossal = true;
game.Add(this);
}
示例9: Projectile
public Projectile(GameObject obj, GameController game, float variance, Vector4 color, float damage, bool randomDirection, bool homing)
: base(game)
{
this.pos = obj.pos;
this.game = game;
if (obj.type == GameObjectType.Player || obj.type == GameObjectType.MirrorPlayer)
{
this.type = GameObjectType.ProjectilePlayer;
}
else
{
this.type = GameObjectType.ProjectileEnemy;
}
// Model
// projectile color - default blue, otherwise copies the shooter's color
if (obj.colorDefault == Constants.noColor) this.colorDefault = Constants.blue;
else this.colorDefault = obj.colorDefault;
// Init values
this.colorDefault = color;
this.color = colorDefault;
this.texturename = null;
this.modelname = Constants.model_projectile;
getSizeRatioAndTransformation();
this.showLighting = false;
// Stats
hp = Constants.projectile_base_size + obj.hp/10; // Here HP and MASS just determines size of the projectile
mass = hp / size_ratio;
this.damage = damage;
this.maxRotationSpeed = Constants.projectileRotationSpeed;
// Set base speed and accel
this.movementSpeed = Constants.projectile_speed;
this.acceleration = Constants.projectile_accel;
// Initial accel and velocity is in the direction of the shooter
this.accX = acceleration * ((float)Math.Cos(obj.rotationAngle));
this.accY = acceleration * ((float)Math.Sin(obj.rotationAngle));
this.velX = obj.velX;
this.velY = obj.velY;
// Random projectile direction if applicable
if (randomDirection)
{
accX = accX + ((float)game.random.NextDouble() * variance * 2 - variance);
accY = accY + ((float)game.random.NextDouble() * variance * 2 - variance);
}
this.pos.X += ((float)Math.Cos(obj.rotationAngle)) * obj.mass / 2f;
this.pos.Y += ((float)Math.Sin(obj.rotationAngle)) * obj.mass / 2f;
// Gamelogic
isCollidable = false;
isAffectedByVortex = false;
this.homing = homing;
if (homing) lifeTime = Constants.projectile_lifetime + 400;
else lifeTime = Constants.projectile_lifetime;
refreshModel(color);
game.Add(this);
}