Beispiel #1
0
        public override Balloon Update(Unicorn unicorn)
        {
            if(!activatedOnce && !isActive)
            {
                activatedOnce = true;
                ActivateAll();
            }

            return base.Update(unicorn);
        }
Beispiel #2
0
 public override Balloon Update(Unicorn unicorn)
 {
     Balloon balloon = base.Update(unicorn);
     Vector2 difference = _body.Position - ConvertUnits.ToSimUnits(unicorn.CenterPosition);
     if (isActive && difference.Length() <= SCARE_RADIUS)
     {
         _body.ApplyForce(Vector2.Normalize(difference)*ACCELERATION_MODIFIER*9.8f);
     }
     else
     {
         _body.LinearVelocity = Vector2.Zero;
     }
     Position = ConvertUnits.ToDisplayUnits(_body.Position) - new Vector2(width / 2, height / 2);
     return balloon;
 }
Beispiel #3
0
        public void Initialize(Game game, ContentManager content, ref GraphicsDeviceManager  graphics)
        {
            uno = new Unicorn(game, content);
            // Create a world for physics to act
            world = new World(new Vector2(0f, 9.8f));

            this.graphics = graphics;

            this.uno = uno;
            this.content = content;
            level = 0;

            mapDisplayDevice = new XnaDisplayDevice(content, graphics.GraphicsDevice);

            viewport = new xTile.Dimensions.Rectangle(new Size(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));

            nextLevelCallDelay = false;
        }
Beispiel #4
0
        public virtual Balloon Update(Unicorn unicorn)
        {
            float distance = Vector2.Distance(unicorn.GetCenterPos(), Position + new Vector2(width/2, height/2) );

            if (Math.Abs(distance) < 96)
            {
                ExitPortal exit = GameManager.getInstance().exit;
                if(isActive && exit != null)
                    exit.IncreasePhase();

                if (isActive)
                {
                    popAudio.Play();
                }

                isActive = false;
                Destroy();

                return this;
            }

            return null;
        }