protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _sfxButtonPress = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS); _sfxHit = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT); _sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED); _spriteSheetTexture = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET); _fadeInAnimation = new Texture2D(GraphicsDevice, 1, 1); _fadeInAnimation.SetData(new Color[] { Color.White }); _TRex = new TRex(_spriteSheetTexture, new Vector2(Trexpos, TrexYpos - TRex.TrexHeiht), _sfxButtonPress); _TRex.DrewOrder = 10; _InputController = new ImputController(_TRex); _groundmanager = new GroundManager(_spriteSheetTexture, _entityManager, _TRex); _entityManager.AddEntity(_TRex); _entityManager.AddEntity(_groundmanager); _groundmanager.Initialize(); }
static void AbstractDemo() { TRex myTrex = new TRex(); Triceratops myTriceratops = new Triceratops(); myTrex.EatFood(); myTrex.Move(); myTrex.Sleeps(); myTrex.Communicates(); myTrex.SkinType(); myTrex.Teeth(); Console.WriteLine(" "); myTriceratops.EatFood(); // has not been overwritten so "the dinosaur moves" myTriceratops.Move(); myTriceratops.Sleeps(); myTriceratops.Communicates(); myTriceratops.SkinType(); myTriceratops.Teeth(); Console.WriteLine(" "); Teradactyl myTeradactyl = new Teradactyl(); myTeradactyl.EatFood(); myTeradactyl.Move(); myTeradactyl.Sleeps(); myTeradactyl.Communicates(); myTeradactyl.Teeth(); myTeradactyl.SkinType(); }
public void TRexsShouldBeTRexs() { IBattleable trex = new TRex(); Assert.AreEqual(trex.Type, CharacterTypes.TRex); Assert.IsTrue(trex is TRex); }
//Atacar solo si ha pasado 1s desde el anterior ataque public IEstadoHormiga Update(Hormiga h) { //Si el objetivo esta muerto vamos al estado de muerte, ya que la hormiga ya ha comenzado su ataque suicida aunque no haga daño a ningun enemigo if (target == null) { return(h.eMuerta); } //Comprobamos que tipo de enemigo es para hacerle daño correctamente if (target.gameObject.CompareTag("Gallina")) { Gallina g = target.gameObject.GetComponent <Gallina>(); g.GetHit(h.fuerza); } if (target.gameObject.CompareTag("Pulpo")) { Octopus o = target.gameObject.GetComponent <Octopus>(); o.GetHit(h.fuerza); } if (target.gameObject.CompareTag("TRex")) { TRex t = target.gameObject.GetComponent <TRex>(); t.GetHit(h.fuerza); } return(h.eMuerta); }
static void AbstractDemo() { TRex trex = new TRex(); Triceratops tri = new Triceratops(); Archaeopteryx arc = new Archaeopteryx(); NarratorLizard nl = new NarratorLizard(); }
public IStatesTRex Update(TRex t) { //Elige una dirección aleatoria. t.agent.speed = speed; t.agent.destination = t.transform.position + new Vector3((Random.value - 0.5f) * 80, (Random.value - 0.5f) * 80, (Random.value - 0.5f) * 80); return(t.wanderState); }
public async Task ManualTRexTest_CreateImportedFile(string uriRoot) { const string testText = "File Import Misc 2"; Msg.Title(testText, "Create standard project then upload a new design surface file."); var ts = new TestSupport(); var customerUid = Guid.NewGuid(); var startDateTime = ts.FirstEventDate; var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1); ts.ProjectUid = new Guid(createProjectResponse.Result.Id); var importFile = new ImportFile(uriRoot); var importFilename = TestFileResolver.File(TestFile.TestDesignSurface3_GoodContent); var fullFilePath = TestFileResolver.GetFullPath(importFilename); var importFileArray = new[] { "| EventType | ProjectUid | CustomerUid | Name | ImportedFileType | FileCreatedUtc | FileUpdatedUtc | ImportedBy | IsActivated | MinZoomLevel | MaxZoomLevel |", $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath} | 1 | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true | 15 | 19 |" }; var filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post, new[] { "filename=TestDesignSurfaceTestDesignSurface3_GoodContent.TTM" })); Assert.NotNull(filesResult); Assert.Equal(0, filesResult.Code); Assert.Equal(ts.ProjectUid.ToString(), filesResult.ImportedFileDescriptor.ProjectUid); var trexService = new TRex(); var designsResult = await trexService.GetDesignsFromTrex(customerUid.ToString(), ts.ProjectUid.ToString()); Assert.Equal(0, designsResult.Code); Assert.Single(designsResult.DesignFileDescriptors); Assert.Equal(filesResult.ImportedFileDescriptor.ImportedFileUid, designsResult.DesignFileDescriptors[0].DesignUid); Assert.Equal("TestDesignSurface3_GoodContent.TTM", designsResult.DesignFileDescriptors[0].Name); }
public static void SurfaceAnimals() { Console.WriteLine("Pterodactyl I am!"); Pterodactyl pterodactyl = new Pterodactyl(); Console.WriteLine($"Tail: {pterodactyl.Tail}."); Console.WriteLine($"Location: {pterodactyl.Location}."); Console.WriteLine($"Feed Cost:${pterodactyl.FeedCost}."); Console.WriteLine($"# of Eyes: {pterodactyl.Eyes}."); Console.WriteLine($"Are they Safe: {pterodactyl.Safe}."); Console.WriteLine($"Flyer: {pterodactyl.Flyer()}."); Console.WriteLine($"Eat: {pterodactyl.Eat()}."); Console.WriteLine($"Speak: {pterodactyl.Speak()}."); Console.WriteLine(""); Console.WriteLine("Flying-Spider I am!"); FlyingSpider flyingSpider = new FlyingSpider(); Console.WriteLine($"Tail: {flyingSpider.Tail}."); Console.WriteLine($"Location: {flyingSpider.Location}."); Console.WriteLine($"Feed Cost:${flyingSpider.FeedCost}."); Console.WriteLine($"# of Eyes: {flyingSpider.Eyes}."); Console.WriteLine($"Are they Safe: {flyingSpider.Safe()}."); Console.WriteLine($"Flyer: {flyingSpider.Flyer()}."); Console.WriteLine($"Eat: {flyingSpider.Eat()}."); Console.WriteLine($"Speak: {flyingSpider.Speak()}."); //Two Interfaces here! Console.WriteLine(""); Console.WriteLine("T-Rex I am!"); TRex rex = new TRex(); Console.WriteLine($"Tail: {rex.Tail}."); Console.WriteLine($"Location: {rex.Location}."); Console.WriteLine($"Feed Cost:${rex.FeedCost}."); Console.WriteLine($"# of Eyes: {rex.Eyes}."); Console.WriteLine($"Are they Safe: {rex.Safe}."); Console.WriteLine($"Walking: {rex.Walking()}."); Console.WriteLine($"Eat: {rex.Eat()}."); Console.WriteLine($"Speak: {rex.Speak()}."); Console.WriteLine($"Drinking: {rex.Drinking()}."); Console.WriteLine($"Interface => Fun Tricks: {rex.FunTricks}."); Console.WriteLine($"Interface => Loves Humans: {rex.lovesHumans}."); Console.WriteLine(""); Console.WriteLine("Brontosaurus I am!"); Brontosaurs brontosaurs = new Brontosaurs(); Console.WriteLine($"Tail: {brontosaurs.Tail}."); Console.WriteLine($"Location: {brontosaurs.Location}."); Console.WriteLine($"Feed Cost:${brontosaurs.FeedCost}."); Console.WriteLine($"# of Eyes: {brontosaurs.Eyes}."); Console.WriteLine($"Are they Safe: {brontosaurs.Safe}."); Console.WriteLine($"Walking: {brontosaurs.Walking()}."); Console.WriteLine($"Eat: {brontosaurs.Eat()}."); Console.WriteLine($"Speak: {brontosaurs.Speak()}."); Console.WriteLine($"Drinking: {brontosaurs.Drinking()}."); }
public void UnicornShouldBeatTRex() { IBattleable unicorn = new Unicorn(); IBattleable trex = new TRex(); bool result = unicorn.Battle(trex); Assert.IsTrue(result); }
public void TRexShouldNotBeatTRex() { IBattleable trexOne = new TRex(); IBattleable trexTwo = new TRex(); bool result = trexOne.Battle(trexTwo); Assert.IsFalse(result); }
public void TRexShouldNotBeatDragon() { IBattleable trex = new TRex(); IBattleable dragon = new Dragon(); bool result = trex.Battle(dragon); Assert.IsFalse(result); }
//Atacar solo si ha pasado 1s desde el anterior ataque public IEstadoGallina Update(Gallina g) { if (Time.time - time > 1) { time = Time.time; //Si el objetivo esta muerto volvemos a buscar if (target == null) { return(g.eBuscar); } //Comprobamos que tipo de enemigo es para hacerle daño correctamente if (target.gameObject.CompareTag("Hormiga")) { Hormiga h = target.gameObject.GetComponent <Hormiga>(); if (h == null) { HormigaReina hr = target.gameObject.GetComponent <HormigaReina>(); hr.GetHit(g.berserk ? g.fuerza * 3 : g.fuerza); } else { h.GetHit(); } } if (target.gameObject.CompareTag("Pulpo")) { Octopus o = target.gameObject.GetComponent <Octopus>(); o.GetHit(g.berserk ? g.fuerza * 3 : g.fuerza); } if (target.gameObject.CompareTag("TRex")) { TRex t = target.gameObject.GetComponent <TRex>(); t.GetHit(g.berserk ? g.fuerza * 3 : g.fuerza); } //Cada ataque reduce un poco la fuerza de la gallina if (g.fuerza > 10) { g.fuerza -= 1; } //Si el ataque acabo con su objetivo, la gallina se lo come para restaurar sus estadisticas if (target == null) { g.vida = g.vidaInicial; g.fuerza = g.fuerzaInicial; g.velocidad = g.velocidadInicial; g.berserk = false; } } return(g.eAtacar); }
public void TRexShouldBeatWearwolf() { IBattleable trex = new TRex(); IBattleable wearwolf = new Wearwolf(); bool result = trex.Battle(wearwolf); Assert.IsTrue(result); }
public void DragonShouldBeatTRex() { IBattleable dragon = new Dragon(); IBattleable trex = new TRex(); bool result = dragon.Battle(trex); Assert.IsTrue(result); }
public void WearwolfShouldNotBeatTRex() { IBattleable wearwolf = new Wearwolf(); IBattleable trex = new TRex(); bool result = wearwolf.Battle(trex); Assert.IsFalse(result); }
public TRexRunnerGame() { _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; _entityManager = new EntityManager(); State = GameState.Initial; _fadeInTexturePosX = TRex.GetWidth(); }
public void TRexShouldNotBeatUnicorn() { IBattleable trex = new TRex(); IBattleable unicorn = new Unicorn(); bool result = trex.Battle(unicorn); Assert.IsFalse(result); }
void Start() { for (int i = 0; i < Settings.numTrex; i++) { TRex t = Instantiate(trexPrefab).GetComponent <TRex>(); t.transform.parent = transform; t.transform.position = transform.position; } }
public IStatesTRex Update(TRex t) { //Calcula la fuerza en función del tamaño y de si hay aliados. force = Settings.tamTrex * 7.5f; if (t.grouped > 0) { force *= 2; } //Dependiendo del enemigo y de sus características ve si debe atacar o huir. if (t.enemy.gameObject.CompareTag("Pulpo")) { int rand = Random.Range((int)(force * 0.75f), (int)(force * 1.25f)); if (rand < Settings.tamPulpos * 10) { return(t.runState); } else { return(t.attackState); } } else if (t.enemy.gameObject.CompareTag("Hormiga")) { Hormiga rival = t.enemy.GetComponent <Hormiga>(); if (rival == null) { int rand = Random.Range((int)(force * 0.75f), (int)(force * 1.25f)); if (rand < Settings.tamHormigas * 5) { return(t.runState); } else { return(t.attackState); } } else { return(t.attackState); } } else { int rand = Random.Range((int)(force * 0.75f), (int)(force * 1.25f)); if (rand < Settings.tamGallinas) { return(t.runState); } else { return(t.attackState); } } }
static void AbstractDemo() { TRex trex = new TRex(); Triceratops triceratops = new Triceratops(); trex.EatFood(); trex.Move(); trex.SkinType(); triceratops.EatFood(); triceratops.Move(); triceratops.Teeth(); }
public IStatesTRex Update(TRex t) { //Si no ha acabado su huida sigue corriendo. if (!done) { t.agent.speed = runSpeed; t.agent.destination = t.transform.position - 4 * (t.enemy.transform.position - t.transform.position); done = true; } //Si ha huido vaga por el mapa de nuevo. if (t.agent.remainingDistance == 0) { t.enemy = null; done = false; return(t.wanderState); } else { return(t.runState); } }
private static void Week4FundamentalsReview() { //Fundamentals /* * example of calling a static class and its static method, noting * that we do not need to instantiate an instance of the class to use it */ Console.WriteLine(Utility.AddTwoNumbers(7, 6)); //the square has access to the abstract class Shape's properties (ie: square.Sides) Square square = new Square(5, 5); square.Sides = 100; Console.WriteLine(square.Area()); //Generics example Dinosaur dino1G = new Dinosaur(); Dinosaur dino2G = new Dinosaur(); Dinosaur dino3G = new Dinosaur(); TRex tRexG = new TRex(); GenericsList <Dinosaur> dinoList = new GenericsList <Dinosaur>(); dinoList.Add(dino1G); dinoList.Add(dino2G); dinoList.Add(dino3G); dinoList.Add(tRexG); //Indexers IndexerSample indexSample = new IndexerSample(); for (int i = 0; i < indexSample.Length; i++) { Console.WriteLine(indexSample[i]); } }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here _sfxHit = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT); _sfxButtonPress = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS); _sfxScoredReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED); _spriteSheetTexture = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET); _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1); _fadeInTexture.SetData(new Color[] { Color.White }); _tRex = new TRex(_spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - TRex.GetHeight()), _sfxButtonPress); _tRex.DrawOrder = 10; _tRex.JumpComplete += tRex_JumpComplete; _tRex.Died += tRex_Died; _scoreBoard = new ScoreBoard(_spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_y), _tRex); _inputController = new InputController(_tRex); _groundManager = new GroundManager(_spriteSheetTexture, _entityManager, _tRex); _obstacleManager = new ObstacleManager(_entityManager, _tRex, _scoreBoard, _spriteSheetTexture); _gameOverScreen = new GameOverScreen(_spriteSheetTexture, this); _gameOverScreen.Position = new Vector2(WINDOW_WIDTH / 2 - GameOverScreen.GAME_OVER_SPRITE_WIDTH / 2, WINDOW_HEIGHT / 2 - 30); _entityManager.AddEntity(_tRex); _entityManager.AddEntity(_groundManager); _entityManager.AddEntity(_scoreBoard); _entityManager.AddEntity(_obstacleManager); _entityManager.AddEntity(_gameOverScreen); _groundManager.Initialize(); }
public IStatesOctopus Update(Octopus o) { //Si no hay enemigo, vaga. if (o.enemy == null) { return(o.wanderState); } //Si está en el agua, es más rápido y más fuerte. if (o.water) { force = Settings.tamPulpos * 15f; o.agent.speed = speed * 2; } else { //Si su vida es baja, huye. if (o.health < Settings.tamPulpos * 15) { return(o.runState); } force = Settings.tamPulpos * 5f; o.agent.speed = speed; } //Si no hay colisión, sigue persiguiendo. if (!colision) { o.agent.isStopped = false; if (o.enemy == null) { return(o.wanderState); } else { o.agent.destination = o.enemy.transform.position; return(o.attackState); } //Si la hay, ataca. } else { colision = false; if (Time.time - time > 1f) { time = Time.time; //Se para. o.agent.isStopped = true; //Llama a las funciones de recibir daño del rival. if (o.enemy.gameObject.CompareTag("TRex")) { TRex rival = o.enemy.GetComponent <TRex>(); rival.GetHit((int)force); } else if (o.enemy.gameObject.CompareTag("Hormiga")) { Hormiga rival = o.enemy.GetComponent <Hormiga>(); if (rival == null) { HormigaReina rivalHR = o.enemy.GetComponent <HormigaReina>(); rivalHR.GetHit((int)force); } else { rival.GetHit(); } } else if (o.enemy.gameObject.CompareTag("Gallina")) { Gallina rival = o.enemy.GetComponent <Gallina>(); rival.GetHit((int)force); } } } return(o.attackState); }
public static void RunWeek3Classwork() { //Week 3 in class //Deconstructor //ClassMaterial.Week1.Week3.Square MySquare0 = new ClassMaterial.Week1.Week3.Square(11,22); ClassMaterial.Week1.Week3.Square MySquare = new ClassMaterial.Week1.Week3.Square(3, 3); // //var (length, height) = MySquare; // int length = 5, height = 5;//////////, top = 100; MySquare.Deconstruct(out length, out height); //////////, out top); System.Console.WriteLine("MySquare.Length = " + MySquare.Length); // (length, height) = MySquare; System.Console.WriteLine("2nd MySquare.Length = " + MySquare.Length); //ClassMaterial.Week1.Week3.Square MySquare2 = new ClassMaterial.Week1.Week3.Square(,); //MySquare.Deconstruct(out length, out height); System.Console.WriteLine(length); // //ClassMaterial.Week1.Week3.Square MySquare3 = new ClassMaterial.Week1.Week3.Square(3,3); ClassMaterial.Week1.Week3.Square yourSquare = new ClassMaterial.Week1.Week3.Square { Length = 5, Height = 5, Color = "Blue" }; Dinosaur dino1 = new Dinosaur(); dino1.Size = 10; TRex tRex = new TRex(); tRex.Size = 20; Dinosaur dino2 = new TRex(); //upcasting //Now play with private, public, protected and sealed of the // base and child class to see // what you can access with the dot operator dino2.Eat(); Dinosaur dino3 = new Pterodactyl(); //upcasting dino3.Eat(); Dinosaur dino4 = new Dinosaur(); dino4 = (TRex)tRex; dino4.Eat(); dino4 = (Pterodactyl)dino3; dino4.Eat(); System.Console.WriteLine("Now let's try an IS:"); Dinosaur[] dinoArray = { dino1, tRex, dino2, dino3 }; foreach (Dinosaur item in dinoArray) { if (item is TRex) { item.Eat(); } /* * if( item is Pterodactyl) * { * item.Sleep(); * * } * */ } System.Console.WriteLine(Utility.AddTwoNumbers(10101, 1010)); System.Console.WriteLine(Utility.AddTwoNumbers(10101, 1010)); var dinoList = new List <Dinosaur>(10000); dinoList.Add(dino1); dinoList.Add(tRex); dinoList.Add(dino2); dinoList.Add(dino3); foreach (var item in dinoList) { Console.WriteLine(item); } dinoList.ForEach(item => Console.Write(item + ",")); System.Console.WriteLine("Week3Classwork"); }
public void Create(out ICreature obj) => obj = new TRex();
public void MakeADinosaurNoise() { IDinosaur dinosaur = new TRex(); dinosaur.MakeANoise(); }
public ImputController(TRex trex) { this._Trex = trex; }
public IStatesTRex Update(TRex t) { //Si el enemigo desaparece, el TRex vaga. if (t.enemy == null) { return(t.wanderState); } t.agent.speed = attackSpeed; force = Settings.tamTrex * 20; //Si no hay colisión, sigue persiguiendo. if (!colision) { t.agent.isStopped = false; if (t.enemy == null) { return(t.wanderState); } else { t.agent.destination = t.enemy.transform.position; return(t.attackState); } //Si hay colisión, ataca. } else { colision = false; if (Time.time - time > 1f) { time = Time.time; //Se para. t.agent.isStopped = true; //Si es un pulpo, ataca hasta morir o matar, si lo mata puede comer. if (t.enemy.gameObject.CompareTag("Pulpo")) { Octopus rival = t.enemy.GetComponent <Octopus>(); rival.GetHit((int)force); if (t.enemy == null) { t.health += 20; } //Si es una hormiga, ataca hasta matar o morir. } else if (t.enemy.gameObject.CompareTag("Hormiga")) { Hormiga rival = t.enemy.GetComponent <Hormiga>(); if (rival == null) { HormigaReina rivalHR = t.enemy.GetComponent <HormigaReina>(); rivalHR.GetHit((int)force); } else { rival.GetHit(); } //Si es una gallina, ataca hasta morir o matar, si lo mata puede comer. } else if (t.enemy.gameObject.CompareTag("Gallina")) { Gallina rival = t.enemy.GetComponent <Gallina>(); rival.GetHit((int)force); if (t.enemy == null) { t.health += 20; } } } } return(t.attackState); }
public InputController(TRex tRex) { _tRex = tRex; }