public Peon(Engine game, PeonManager manager, Texture2D gfxPlaceholder, Vector2 position) : base(game) { this.game = game; this.tex = new SpriteSheet(gfxPlaceholder, new Vector2(21, 20), 3.0f); this.glow = new SpriteSheet(Engine.ContentManager.Load <Texture2D>("glowPeon"), new Vector2(26, 30), 3); sfxWorshipping = Engine.ContentManager.Load <SoundEffect>("sound/bleep"); boundingCircle = new BoundingCircle(position, 10); comfortZone = new BoundingCircle(position, 20); this.tex.Position = position; //opacity = 1.0f; //this.gfxPlaceholder.FrameCount = 3; favorTex = Engine.ContentManager.Load <Texture2D>("favorBar"); favorBorder = Engine.ContentManager.Load <Texture2D>("favorBorder"); this.tex.Origin = new Vector2(10, 10); glow.Origin = new Vector2(13, 15); // add our peon to the manager which contains all peons manager.addPeon(this); vehicle = new Vehicle(); vehicle.Position = position; opacity = 0.1f; //startFollowingPlayer(Engine.playerOne); startWandering(); this.peonManager = manager; }
public Powerup(Vector2 position, PowerupType type) { this.type = type; this.position = position; createTime = DateTime.Now; switch (type) { case PowerupType.NUKE: texture = Engine.ContentManager.Load <Texture2D>("ankh"); break; case PowerupType.RADIUS: texture = Engine.ContentManager.Load <Texture2D>("flute"); break; case PowerupType.SPEED: texture = Engine.ContentManager.Load <Texture2D>("goat"); break; case PowerupType.FREEZE: texture = Engine.ContentManager.Load <Texture2D>("freeze"); break; } //bounds = new BoundingBox(new Vector3(position, 0), new Vector3(position + new Vector2(texture.Width, texture.Height), 0)); bounds = new BoundingCircle(this.position + (new Vector2(texture.Width, texture.Height) / 2), texture.Width / 2); }
public Player(PlayerIndex player, Engine game) : base(game) { this.game = game; this.player = player; Engine.InputManager.LeftStickMove += new Input.ControllerStickEvent(InputManager_LeftStickMove); tex = new SpriteSheet(Engine.ContentManager.Load <Texture2D>("demigod"), new Vector2(30, 31), 3); tex.Origin = new Vector2(15, 15); bigHead1 = new SpriteSheet(Engine.ContentManager.Load <Texture2D>(@"mainCharHigh"), new Vector2(64, 89), 1); bigHead1.Origin = new Vector2(32f, 44.5f); //bighead1.Scale = new Vector2(0.25f, 0.45f); bigHead2 = new SpriteSheet(Engine.ContentManager.Load <Texture2D>(@"mainCharHigh"), new Vector2(64, 89), 1); bigHead2.Origin = new Vector2(32f, 44.5f); bounds = new Rectangle(); attachedPeons = new List <Peon>(); vehicle = new Vehicle(); playerCircle = Engine.ContentManager.Load <Texture2D>("playercircle"); circleorigin = new Vector2(playerCircle.Width / 2, playerCircle.Height / 2); circlescale = Vector2.One; favorRadius = Engine.ContentManager.Load <Texture2D>("favorradius"); favorRadiusOrigin = new Vector2(favorRadius.Width / 2, favorRadius.Height / 2); boundingCircle = new BoundingCircle(position, radius); }
public Vector2 avoidCircle(BoundingCircle me, BoundingCircle circle) { Debug.Assert(position == me.Position); if (me.intersects(circle)) { // calculate the direction we need to move to resolve the collision Vector2 dir = Vector2.Normalize(me.Position - circle.Position); // scale the direction by the amount we intersect the circle dir *= (me.Radius + circle.Radius) - Vector2.Distance(position, circle.Position); return(dir); } return(Vector2.Zero); }
public Temple(PlayerIndex owner, Vector2 position, Texture2D goldtexture, Texture2D greytexture, Player player) { this.owner = owner; this.position = position; greyTexture = greytexture; goldTexture = goldtexture; blueTexture = Engine.ContentManager.Load <Texture2D>("templeBlue"); boundingCircle = new BoundingCircle(position + new Vector2(greytexture.Width / 2, greytexture.Height / 2), 150); peons = new List <Peon>(); rand = new Random(DateTime.Now.Millisecond); }
public bool intersects(BoundingCircle other) { return(Vector2.Distance(other.position, position) <= (radius + other.radius)); }
public Vector2 avoidPoint(BoundingCircle me, Vector2 other) { // FIXME: implement return(Vector2.Zero); }