public void Add(DrawnActor2D actor)
 {
     if (actor != null)
     {
         this.hudList.Add(actor);
     }
 }
Ejemplo n.º 2
0
        public bool Remove(string menuSceneID, Predicate <DrawnActor2D> predicate)
        {
            DrawnActor2D foundUIObject = Find(menuSceneID, predicate);

            if (foundUIObject != null)
            {
                return(this.menuDictionary[menuSceneID].Remove(foundUIObject));
            }

            return(false);
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            DrawnActor2D other = obj as DrawnActor2D;

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

            return(this.Color.Equals(other.Color) && base.Equals(obj));
        }
Ejemplo n.º 4
0
        public new object Clone()
        {
            IActor actor = new DrawnActor2D("clone - " + ID,                     //deep
                                            this.ActorType,                      //deep
                                            (Transform2D)this.Transform.Clone(), //deep - calls the clone for Transform3D explicitly
                                            this.StatusType,                     //deep - enum type
                                            this.Color,                          //deep
                                            this.spriteEffects,                  //deep - enum type
                                            this.LayerDepth);                    //deep - a simple numeric type

            //clone each of the (behavioural) controllers
            foreach (IController controller in this.ControllerList)
            {
                actor.AttachController((IController)controller.Clone());
            }

            return(actor);
        }
Ejemplo n.º 5
0
        public void Add(string menuSceneID, DrawnActor2D actor)
        {
            if (this.menuDictionary.ContainsKey(menuSceneID))
            {
                this.menuDictionary[menuSceneID].Add(actor);
            }
            else
            {
                List <DrawnActor2D> newList = new List <DrawnActor2D>();
                newList.Add(actor);
                this.menuDictionary.Add(menuSceneID, newList);
            }

            //if the user forgets to set the active list then set to the sceneID of the last added item
            if (this.activeList == null)
            {
                SetActiveList(menuSceneID);
            }
        }
Ejemplo n.º 6
0
        private void EventDispatcher_GlobalSoundChanged(EventData eventData)
        {
            DrawnActor2D volTracker = this.menuDictionary["audio menu"].Find(actor => actor.GetID().Equals("tracker1"));
            DrawnActor2D volSlider  = this.menuDictionary["audio menu"].Find(actor => actor.GetID().Equals("slider1"));

            if (eventData.EventType == EventActionType.OnVolumeUp)
            {
                if (volTracker.Transform.Translation.X < (volSlider.Transform.Translation.X + 430))
                {
                    volTracker.Transform.Translation += new Vector2(10, 0);
                }
            }
            else if (eventData.EventType == EventActionType.OnVolumeDown)
            {
                if (volTracker.Transform.Translation.X > volSlider.Transform.Translation.X)
                {
                    volTracker.Transform.Translation -= new Vector2(10, 0);
                }
            }
        }
Ejemplo n.º 7
0
        public override void Update(GameTime gameTime, IActor actor)
        {
            DrawnActor2D parentActor = actor as DrawnActor2D;



            if (parentActor.Transform.Bounds.Intersects(this.mouseManager.Bounds))
            {
                TrigonometricParameters trig = new TrigonometricParameters(1, 0.1f);
                this.totalElapsedTime += gameTime.ElapsedGameTime.Milliseconds;

                float lerpFactor = MathUtility.Sin(trig, this.totalElapsedTime);

                parentActor.Color           = MathUtility.Lerp(Color.Red, Color.Blue, lerpFactor);
                parentActor.Transform.Scale = MathUtility.Lerp(parentActor.Transform.Scale * 0.999f, parentActor.Transform.Scale * 1.001f, lerpFactor);
                Console.WriteLine(parentActor.Transform.Scale);

                if (this.mouseManager.IsLeftButtonClicked())
                {
                    if (parentActor.ID.Equals("menu1"))
                    {
                        EventDispatcher.Publish(new EventData("options", null, EventActionType.OnNewMenu, EventCategoryType.Menu));
                    }
                    else if (parentActor.ID.Equals("exit1"))
                    {
                        exit = true;
                    }
                }
            }
            else
            {
                parentActor.Transform.Scale = parentActor.Transform.OriginalTransform2D.Scale;
                parentActor.Color           = parentActor.OriginalColor;
            }

            base.Update(gameTime, actor);
        }
Ejemplo n.º 8
0
 protected virtual void HandleMouseClick(DrawnActor2D uiObject, GameTime gameTime)
 {
     //developer implements in subclass of MenuManager - see MyMenuManager.cs
 }