Exemplo n.º 1
0
        private void ManageUpdateHealth(PacketHealthUpdate packet)
        {
            DeusComponent component = FindComponent(packet.ObjectId, packet.ComponentId);

            if (component != null && component is HealthTimeLineComponent)
            {
                (component as HealthTimeLineComponent).InsertData(packet.NewHealthAmount, packet.NewHealthTimestamp);

                //// Notify the view, that component value has just changed : use this only if your component isn't getting in realtime informations
                //PacketUpdateViewObject feedBackPacket = new PacketUpdateViewObject();
                //feedBackPacket.ObjectId = packet.ObjectId;
                //feedBackPacket.ComponentId = packet.ComponentId;
                //feedBackPacket.NewValue = packet.NewHealthAmount;
                //EventManager.Get().EnqueuePacket(0, feedBackPacket);
            }
        }
Exemplo n.º 2
0
        private void UpdateTimelineComponent <T, U>(uint objectId, EComponentType componentType, U originValue, uint originTimestampMs, U destinationValue, uint destinationTimestampMs) where T : TimeLineComponent <U>
        {
            DeusComponent component = FindComponent(objectId, componentType);

            if (component != null && component is T)
            {
                if (originValue != null)
                {
                    (component as T).InsertData(originValue, originTimestampMs);
                }

                if (destinationValue != null)
                {
                    (component as T).InsertData(destinationValue, destinationTimestampMs);
                }
            }
        }