public void Load() { Statistics statistics = new Statistics(); statistics.HealthPoint = 100; statistics.Position = new TV_3DVECTOR(10, 0, 10); statistics.MaxHealthPoint = 120; creatureService.createCreature(CharacterName.DWARF, statistics); }
private TV_3DVECTOR getDirection(Statistics statistics, TV_3DVECTOR targetPos) { var pos = statistics.Position; TV_3DVECTOR dVector = new TV_3DVECTOR(); Game.Math.TVVec3Subtract(ref dVector, targetPos, pos); Game.Math.TVVec3Normalize(ref dVector, dVector); return dVector; }
public void testReceiveDamageShouldDeadWhenDamageEqualsHealtPoint() { //given Statistics player = new Statistics(); player.HealthPoint = 7; underTest.Statistics = player; //when underTest.receiveDamage(7); Assert.AreEqual(true, player.IsDead); }
public void testReceiveDamageShouldAliveWhenDamageLessThanHealtPoint() { //given Statistics player = new Statistics(); player.HealthPoint = 10; underTest.Statistics = player; //when underTest.receiveDamage(2); Assert.AreEqual(8, player.HealthPoint); }
public Creature createCreature(CharacterName type, Statistics statistics) { String uniqueName = type.ToString() + id; Creature creature = new Creature(container.getObject<Game>("mainGame")); creature.UniqueName = uniqueName; creature.Statistics = statistics; creature.CreatureService = this; creature.CharacterName = type; creature.AnimationService = container.getObject<AnimationService>("animationService"); container.addComponent(creature, uniqueName); creatures.Add(uniqueName, creature); id++; return creature; }
public bool goToTarget(Statistics statistics, TV_3DVECTOR targetPos) { TV_3DVECTOR vec = statistics.Position; if (getDistance(vec, targetPos) > 3) { float frameTime = Game.Engine.TimeElapsed(); float movementSpeed = 0.1f; TV_3DVECTOR dV2 = new TV_3DVECTOR(); float s = frameTime * movementSpeed; Game.Math.TVVec3Scale(ref dV2, getDirection(statistics, targetPos), s); Game.Math.TVVec3Add(ref vec, statistics.Position, dV2); vec.y = landscape.GetHeight(vec.x, vec.z); statistics.Position = vec; return true; } else { return false; } }
public void turnToTargetDirection(Statistics statistics, DetectCollision collision) { statistics.LookAtPoint = collision.getTargetPosition(); }