/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // update objects teddy.Update(gameTime); explosion.Update(gameTime); // explode teddy with click if (Mouse.GetState().LeftButton == ButtonState.Pressed && teddy.DrawRectangle.Contains(Mouse.GetState().X, Mouse.GetState().Y)) { teddy.Active = false; explosion.Play(teddy.DrawRectangle.Center.X, teddy.DrawRectangle.Center.Y); } // create new teddy with rick click after explode it if (teddy.Active == false && Mouse.GetState().RightButton == ButtonState.Pressed) { Vector2 velocity = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble()) / 5; teddy = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear", WindowWidth / 2, WindowHeight / 2, velocity); } base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } MouseState mouse = Mouse.GetState(); if (teddyBear.DrawRectangle.Contains(mouse.Position) && mouse.LeftButton == ButtonState.Pressed) { teddyBear.Active = false; Point location = teddyBear.DrawRectangle.Center; explosion.Play(location.X, location.Y); Vector2 velocity = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble()); velocity *= 0.2f; teddyBear = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear", rand.Next(WindowWidth), rand.Next(WindowHeight), velocity); } teddyBear.Update(gameTime); explosion.Update(gameTime); base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed) { // Create a new teddy bear object int x_velocity = rand.Next(1, 2); int y_velocity = rand.Next(1, 2); int x_rand = rand.Next(0, WINDOW_WIDTH); int y_rand = rand.Next(0, WINDOW_HEIGHT); teddyBear.Active = true; teddyBear = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear", x_rand, y_rand, new Vector2(x_velocity, y_velocity)); } if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed) { explosion.Play((teddyBear.DrawRectangle.X + teddyBear.DrawRectangle.Width / 2), (teddyBear.DrawRectangle.Y + teddyBear.DrawRectangle.Height / 2)); teddyBear.Active = false; } teddyBear.Update(); explosion.Update(gameTime); base.Update(gameTime); }
/// <summary> /// Use this for initialization /// </summary> void Start() { // save reference for efficiency GameObject teddyBearGameObject = GameObject.FindGameObjectWithTag("TeddyBear"); teddyBear = teddyBearGameObject.GetComponent <TeddyBear>(); }
/// <summary> /// Spawns a new teddy bear at a random location /// </summary> /// <param name="gt">game time</param> private void SpawnBearAtMost3(GameTime gt) { if (cooldown < 0) { // generate random velocity, do not generate static bears. float x = 0, y = 0; while (x * x + y * y == 0) { x = GetRandomFloat(-0.5f, 0.5f); y = GetRandomFloat(-0.5f, 0.5f); } Vector2 velocity = new Vector2(x, y); // create new bear TeddyBear newBear = new TeddyBear(teddybearSprite, velocity, WindowWidth, WindowHeight); // add new bear to list bears.Add(newBear); cooldown = GetRandomFloat(1000, 3000); } /// Minus cooldown timer if currently in cooldown process. if (cooldown >= 0) { cooldown -= gt.ElapsedGameTime.Milliseconds; } }
public static void AddInvoker(TeddyBear invoker) { invokers.Add(invoker); foreach (UnityAction <int> listener in listeners) { invoker.AddListener(listener); } }
public override bool TickLocation(Location location) { if (type == Type.Out) { return(true); } fireDuration++; if (fireDuration > 24) { type = Type.Out; } else if (fireDuration > 18) { type = Type.Embers; } else if (fireDuration > 16) { type = Type.Fire; } else if (fireDuration > 8) { type = Type.Inferno; } else if (fireDuration > 4) { type = Type.Fire; } else { type = Type.Spark; } if (type == Type.Fire || type == Type.Inferno) { TeddyBear teddyBear = Utils.FindItemOfType <TeddyBear>(location); if (teddyBear != null) { teddyBear.burned = true; } } if (type == Type.Inferno) { for (int i = 0, count = location.characters.Count; i < count; i++) { Character character = location.characters[i]; if (character != null) { GameManager.paradox = new Paradox(null, character.GetName() + " got cooked in the " + type.ToString() + " of the " + location.name); return(false); } } } return(true); }
/// <summary> /// Adds the given script as an invoker /// </summary> /// <param name="invoker">the invoker</param> public static void AddInvoker(TeddyBear invoker) { // add invoker to list and add all listeners to invoker invokers.Add(invoker); foreach (UnityAction <int> listener in listeners) { invoker.AddListener(listener); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); teddybear = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear", random.Next(0, WindowWidth), random.Next(0, WindowHeight), new Vector2((float)random.NextDouble(), (float)random.NextDouble())); explosion = new Explosion(Content, @"graphics\explosion"); }
public override void Setup() { base.Setup(); TeddyBear newTeddyBear = new TeddyBear(false); bakery.initialItems.Add(newTeddyBear); bakery.initialItems.Add(fire.Copy()); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); teddy = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics/teddybear", 300, 200, new Vector2((float)rdn.NextDouble() * (float)0.5, (float)rdn.NextDouble() * (float)0.5)); explosion = new Explosion(Content, @"graphics/explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Create a TeddyBear bear = GetRandomTeddyBear(); // Create Explosion explosion = new Explosion(Content, @"Graphics\explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here //load bears and explosion bear0 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear0", 300, 300, new Vector2((float)-0.45, 0)); bear1 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear1", 500, 300, new Vector2((float)0.45, 0)); explosion = new Explosion(Content, @"graphics\explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Create a new teddy bear object teddyBear = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear", 50, 50, new Vector2(random.Next(1, 2), random.Next(1, 2))); // Create an Explosion object explosion = new Explosion(Content); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //TODO: use this.Content to load your game content here teddyBear = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear", WindowWidth / 2, WindowHeight / 2, new Vector2((float)rand.NextDouble() * 0.15f, (float)rand.NextDouble() * 0.15f)); explosion = new Explosion(Content, @"graphics\explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // load two teddybears bear0 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear0", 0, 100, new Vector2(1, 0)); bear1 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear1", 800, 100, new Vector2(-1, 0)); // load the explosion explosion = new Explosion(Content, @"graphics\explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Creating two new teddy bear object teddyBear0 = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear0", 10, 100, new Vector2(1, 0)); teddyBear1 = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear1", 0, 10, new Vector2(1, 1)); // Creating an explosion object explosion = new Explosion(Content); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // load content for teddy bear and explosion Vector2 velocity = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble()); velocity *= 0.2f; teddyBear = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear", WindowWidth / 2, WindowHeight / 2, velocity); explosion = new Explosion(Content, "explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); teddyBear0 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear0", 150, 300, new Vector2((float)0.2, 0)); teddyBear1 = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear1", 650, 300, new Vector2((float)-0.2, 0)); explosion = new Explosion(Content, @"graphics\explosion"); }
public override bool Equals(object obj) { TeddyBear teddyBear = obj as TeddyBear; if (teddyBear == null) { return(false); } else { return(this.burned == teddyBear.burned); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here // initialise velocity of bear Vector2 velocity = new Vector2(rand.Next(5), rand.Next(5)); // load bear sprites and velocity bear0 = new TeddyBear(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, "teddybear0", 0, 300, velocity); bear1 = new TeddyBear(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, "teddybear1", 800, 300, velocity); explosion = new Explosion(Content); }
/// <summary> /// LoadContent will be called once per game and is the place to load all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); bear0 = new TeddyBear(Content, WindowWidth, WindowHeight, @"Graphics/teddybear0", 0, 289, new Vector2(0.1F, 0)); bear1 = new TeddyBear(Content, WindowWidth, WindowHeight, @"Graphics/teddybear1", 777, 289, new Vector2(-0.1F, 0)); explosion = new Explosion(Content, @"Graphics\explosion"); bear0.Active = true; bear1.Active = true; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // create teddys teddy0 = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear0", WindowWidth / 3, WindowHeight / 2, new Vector2(-1, 0)); teddy1 = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear1", WindowWidth - WindowWidth / 3, WindowHeight / 2, new Vector2(1, 0)); // create explosion explosion = new Explosion(Content, "explosion"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here // velocity information //Vector2 velocity1 = new Vector2(1, 0); //Vector2 velocity2 = new Vector2(-1, 0); // create teddy bears teddy0 = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear0", 100, 200, new Vector2(4, 0)); teddy1 = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear1", 500, 200, new Vector2(-4, 0)); explode0 = new Explosion(Content); }
public ClawMachine(GLUquadric i_Quadric, uint clawMachineList, uint shadowList, TeddyBear teddyBear, Claw claw) { ClawPosition = new double[3] { 0, 6.1, 0 }; teddyBearsLocations = new List <teddyBearLocation>(); addTeddyBearsLocations(); this.m_Quadric = i_Quadric; this.teddyBear = teddyBear; this.Claw = claw; this.HandleUpDownAngle = -45; this.HandleLeftRightAngle = 0; CreateClawMachine(clawMachineList, false); CreateClawMachine(shadowList, true); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Create a new teddy bear object int x_velocity = rand.Next(1, 2); int y_velocity = rand.Next(1, 2); int x_rand = rand.Next(0, WINDOW_WIDTH); int y_rand = rand.Next(0, WINDOW_HEIGHT); teddyBear = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HEIGHT, "teddybear", x_rand, y_rand, new Vector2(x_velocity, y_velocity)); // Create a new explosion object explosion = new Explosion(Content); }
static void Main() { Bear GrizzlyBear = new Grizzly(); ToyBear MrTeddy = new TeddyBear(); ToyBear ANewBear = new BearAdapter(GrizzlyBear); GrizzlyBear.maul(); GrizzlyBear.hibernate(); MrTeddy.hug(); ANewBear.hug();//adapted Bear class Console.ReadKey(); }
private void SpawnBear() { // Create a teddy bear with a random velocity and location int x = 100 + rand.Next(WindowWidth - 199); int y = 100 + rand.Next(WindowHeight - 199); double speed = rand.NextDouble() / 10 + .1; double angle = 2 * Math.PI * rand.NextDouble(); Vector2 velocity; velocity.X = (float)(Math.Cos(angle) * speed); velocity.Y = (float)(Math.Sin(angle) * speed); bear = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics\teddybear", x, y, velocity); }
public override Action GoalCheck(int currentTime, Character character, bool timeIsUp) { TeddyBear teddyBear = Utils.FindItemOfType <TeddyBear>(character.GetCurrentLocation(), true, true, false); if (teddyBear != null) { GameManager.levelCompleteText = character.GetName() + " is ecstatic to see the Teddy Bear unharmed :D"; GameManager.levelComplete = true; } else { GameManager.paradox = new Paradox(null, character.GetName() + " did not see the Teddy Bear and is inconsolable"); GameManager.Instance.paradoxFound = true; } return(null); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here teddy.Update(gameTime); explosion.Update(gameTime); MouseState mouse = Mouse.GetState(); int x = mouse.Position.X; int y = mouse.Position.Y; if (teddy.DrawRectangle.Contains(x, y) && mouse.LeftButton == ButtonState.Released && previousLeftButtonState == ButtonState.Pressed) { teddy.Active = false; explosion.Play(teddy.DrawRectangle.X, teddy.DrawRectangle.Y); } if (previousMiddleButtonState == ButtonState.Pressed) { teddy = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics/teddybear", 300, 200, new Vector2((float)rdn.NextDouble() * (float)0.5, (float)rdn.NextDouble() * (float)0.5)); } if (previousRightButtonState == ButtonState.Pressed) { explosion.Play(teddy.DrawRectangle.X, teddy.DrawRectangle.Y); teddy = new TeddyBear(Content, WindowWidth, WindowHeight, @"graphics/teddybear", 300, 200, new Vector2((float)rdn.NextDouble() * (float)0.5, (float)rdn.NextDouble() * (float)0.5)); } previousLeftButtonState = mouse.LeftButton; previousMiddleButtonState = mouse.MiddleButton; previousRightButtonState = mouse.RightButton; base.Update(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //load teddy bears bears[0] = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HIGHT, "teddybear0", 100, 100); bears[1] = new TeddyBear(Content, WINDOW_WIDTH, WINDOW_HIGHT, "teddybear1", 200,200); // TODO: use this.Content to load your game content here }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // load content for teddy bear and explosion Vector2 velocity = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble()); velocity *= 0.2f; teddyBear = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear", WindowWidth/2, WindowHeight/2, velocity); explosion = new Explosion(Content, "explosion"); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); MouseState mouse = Mouse.GetState(); if (teddyBear.DrawRectangle.Contains(mouse.Position) && mouse.LeftButton == ButtonState.Pressed){ teddyBear.Active = false; Point location = teddyBear.DrawRectangle.Center; explosion.Play(location.X, location.Y); Vector2 velocity = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble()); velocity *= 0.2f; teddyBear = new TeddyBear(Content, WindowWidth, WindowHeight, "teddybear", rand.Next(WindowWidth), rand.Next(WindowHeight), velocity); } teddyBear.Update(gameTime); explosion.Update(gameTime); base.Update(gameTime); }