Наследование: IHandlerObject
Пример #1
0
        private void MoveCommand(SceneMoveCommandInfo command)
        {
            HandlerSprite obj = objects[command.Name] as HandlerSprite;

            if (obj != null)
            {
                obj.Move(command.X, command.Y, command.Duration);
                obj.Reset();
            }
        }
Пример #2
0
        private void AddCommand(SceneAddCommandInfo command)
        {
            var obj = Info.Objects[command.Object];

            IHandlerObject handler = null;

            if (obj is HandlerSpriteInfo)
            {
                handler = new HandlerSprite(((HandlerSpriteInfo)obj).Sprite, new Point(command.X, command.Y));
            }
            else if (obj is MeterInfo)
            {
                handler = new HandlerMeter(HealthMeter.Create((MeterInfo)obj, false), this);
            }
            handler.Start();
            var name = command.Name ?? Guid.NewGuid().ToString();

            if (!objects.ContainsKey(name))
            {
                objects.Add(name, handler);
            }
        }
Пример #3
0
        private void AddCommand(SceneAddCommandInfo command)
        {
            var obj = Info.Objects[command.Object];

            IHandlerObject handler = null;
            if (obj is HandlerSpriteInfo)
            {
                handler = new HandlerSprite(((HandlerSpriteInfo)obj).Sprite, new Point(command.X, command.Y));
            }
            else if (obj is MeterInfo)
            {
                handler = new HandlerMeter(HealthMeter.Create((MeterInfo)obj, false), this);
            }
            handler.Start();
            var name = command.Name ?? Guid.NewGuid().ToString();
            if (!objects.ContainsKey(name)) objects.Add(name, handler);
        }