Exemple #1
0
        public override void Update(GameTime gameTime, IActor actor)
        {
            if (paused == false)
            {
                this.parentUITextureActor = actor as UITextureObject;
                //set the source rectangle according to whatever start value the user supplies
                if (game.CameraManager.ActiveCamera.StatusType != 0)
                {
                    this.currentValue += incrementSpeed;

                    //if more then 100 Loose

                    if (this.currentValue >= 93)
                    {
                        EventDispatcher.Publish(new EventData("Lose", this, EventActionType.LoseGame, EventCategoryType.Interaction));
                        this.currentValue = 0;
                    }

                    if (this.currentValue < 0)
                    {
                        this.currentValue = 0;
                    }

                    if (incrementSpeed < 0.005f)
                    {
                        incrementSpeed = 0.005f;
                    }


                    UpdateSourceRectangle();
                }
            }
            base.Update(gameTime, actor);
        }
Exemple #2
0
        public override void Update(GameTime gameTime, IActor actor)
        {
            UITextureObject parentActor = actor as UITextureObject;



            this.totalTime += gameTime.ElapsedGameTime.Milliseconds;
            this.count++;
            if (this.temperature <= 0)
            {
                this.isDead = true;
            }

            if (this.totalTime % 1000 == 0)
            {
                if (!this.isDead)
                {
                    this.temperature -= this.dropRate;
                    System.Console.WriteLine(this.temperature);
                    parentActor.Transform.Translation += new Vector2(0, (this.dropRate * 8));
                    parentActor.SourceRectangle        =
                        new Rectangle(parentActor.SourceRectangle.X,
                                      parentActor.SourceRectangle.Y + (int)(this.dropRate * 10),
                                      parentActor.SourceRectangle.Width,
                                      parentActor.SourceRectangle.Height - (int)(this.dropRate * 10)); // TO DO CALCULATION - MATCH THE BAR WITH TEMP - must be double
                                                                                                       // parentActor.SourceRectangleHeight -= (int)(this.dropRate * 20);
                }
            }

            base.Update(gameTime, actor);
        }
Exemple #3
0
 public override void Update(GameTime gameTime, IActor actor)
 {
     //has the value changed?
     if (this.bDirty)
     {
         this.parentUITextureActor = actor as UITextureObject;
         //set the source rectangle according to whatever start value the user supplies
         UpdateSourceRectangle();
         this.bDirty = false;
         HandleWinLose();
     }
     base.Update(gameTime, actor);
 }
Exemple #4
0
        public override bool Equals(object obj)
        {
            UITextureObject other = obj as UITextureObject;

            if (other == null)
            {
                return(false);
            }
            else if (this == other)
            {
                return(true);
            }

            return(this.texture.Equals(other.Texture) &&
                   this.sourceRectangle.Equals(other.SourceRectangle) &&
                   base.Equals(obj));
        }
        public override void Update(GameTime gameTime, IActor actor)
        {
            UITextureObject parentActor = actor as UITextureObject;

            this.totalTime += gameTime.ElapsedGameTime.Milliseconds;
            this.count++;
            if (this.temperature <= 0)
            {
                this.isDead = true;
            }

            if (this.totalTime % 1000 == 0)
            {
                if (!this.isDead)
                {
                    this.temperature -= this.dropRate;
                    System.Console.WriteLine(this.temperature);
                    parentActor.Transform.Translation += new Vector2(0, (this.dropRate * 8));
                    parentActor.SourceRectangle        =
                        new Rectangle(parentActor.SourceRectangle.X,
                                      parentActor.SourceRectangle.Y + (int)(this.dropRate * 10),
                                      parentActor.SourceRectangle.Width,
                                      parentActor.SourceRectangle.Height - (int)(this.dropRate * 10));// TO DO CALCULATION - MATCH THE BAR WITH TEMP - must be double
                    if (temperature <= 10)
                    {
                        //publish low health event
                        EventDispatcher.Publish(new EventData("critical sound", EventActionType.OnHealthSet, EventCategoryType.LowTemp));
                    }
                }
                else
                {
                    //publish gameover event
                    EventDispatcher.Publish(new EventData("Dead By Frosbite!", EventActionType.OnLose, EventCategoryType.GameLost));
                }
            }

            base.Update(gameTime, actor);
        }
Exemple #6
0
        public new object Clone()
        {
            IActor actor = new UITextureObject("clone - " + ID,                     //deep
                                               this.ActorType,                      //deep
                                               this.StatusType,                     //deep - enum type
                                               (Transform2D)this.Transform.Clone(), //deep - calls the clone for Transform3D explicitly
                                               this.Color,                          //deep
                                               this.SpriteEffects,                  //deep - enum type
                                               this.LayerDepth,                     //deep
                                               this.texture,                        //shallow
                                               this.sourceRectangle,                //deep
                                               this.origin);                        //deep

            //clone each of the (behavioural) controllers, if we have any controllers attached
            if (this.ControllerList != null)
            {
                foreach (IController controller in this.ControllerList)
                {
                    actor.AttachController((IController)controller.Clone());
                }
            }

            return(actor);
        }