Exemple #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);
        }