Ejemplo n.º 1
0
        public ViewObject CreateViewObject(ViewObjectCreateArgs args)
        {
            ViewObject viewObject = new ViewObject(args.LinkedGameObject.UniqueIdentifier, args.LinkedGameObject.ObjectType, args.LinkedGameObject.IsLocalPlayer, args.LinkedGameObject.PlayerLinkedId);

            List <IViewableComponent> components = args.LinkedGameObject.GetViewableGameComponents().ToList();

            foreach (var component in components)
            {
                DeusViewComponent tmpComponent = null;
                switch (component.ComponentType)
                {
                case EComponentType.HealthComponent:
                    tmpComponent = new HealthViewComponent(component, component.UniqueIdentifier, args.LinkedGameObject.UniqueIdentifier);
                    break;

                case EComponentType.PositionComponent:
                    break;

                default:
                    break;
                }
                if (tmpComponent != null)
                {
                    viewObject.AddComponent(tmpComponent);
                }
            }

            return(viewObject);
        }
Ejemplo n.º 2
0
        private void ManageViewObjectUpdate(PacketUpdateViewObject packet)
        {
            ViewObject viewObject = m_holdedObjects.FirstOrDefault(vo => vo.UniqueIdentifier == packet.ObjectId);

            if (viewObject != null)
            {
                DeusViewComponent component = viewObject.Get(packet.ComponentId);
                if (component != null)
                {
                    component.UpdateViewValue(packet.NewValue);
                }
            }
        }