Beispiel #1
0
        public Laser(Player player)
            : base(player)
        {
            Modifier = 0.5;

            Energy = TotalEnergy = 150;
            EnergyConsumptionMode = EnergyConsumptionMode.Drain;
            EnergyConsumptionRate = 0.5;
            EnergyRechargeRate = 0.2;

            _particleQueue = new HashSet<Particle>();
            _laserUpdateTimer = new Animation { CompletedDelegate = LaserUpdate };
            _laserUpdateTimerGroup = new AnimationGroup(_laserUpdateTimer, 50) { Loops = true };
            Storage.AnimationController.AddGroup(_laserUpdateTimerGroup);

            _laserSound = Storage.Sound("Laser").CreateInstance();
            _laserSound.IsLooped = true;

            _laserParticles = new ParticleSystem(Player.Game, Player);
            Player.Game.Components.Add(_laserParticles);

            HasMaxDistance = true;
            MaxDistance = 300;
            MaxDistanceColor = Color.Orange;
        }
Beispiel #2
0
        protected Tool(Player player)
        {
            Player = player;

            if(Player is LocalPlayer)
            {
                _energyAnimation = new Animation { CompletedDelegate = EnergyTick };

                _energyAnimationGroup = new AnimationGroup(_energyAnimation, 10) { Loops = true };

                Storage.AnimationController.AddGroup(_energyAnimationGroup);
            }
        }
Beispiel #3
0
        private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            this.CreateAlert("AnimationGroup", "This DesktopAlert is shown and hidden using AnimationGroup!");

            AnimationGroup groupIn = new AnimationGroup();
            groupIn.Children.Add(new FadeAnimation() { Direction = AnimationDirection.In });
            groupIn.Children.Add(new ScaleAnimation() { Direction = AnimationDirection.In, MinScale = 0.9 });

            AnimationGroup groupOut = new AnimationGroup();
            groupOut.Children.Add(new FadeAnimation() { Direction = AnimationDirection.Out });
            groupOut.Children.Add(new ScaleAnimation() { Direction = AnimationDirection.Out, MinScale = 0.9 });

            this.AnimationGroupManager.ShowAnimation = groupIn;
            this.AnimationGroupManager.HideAnimation = groupOut;

            this.AnimationGroupManager.ShowAlert(this.Alert);
        }
Beispiel #4
0
        public Jet(Player player)
            : base(player)
        {
            Modifier = 0.5;

            Energy = TotalEnergy = 100;
            EnergyConsumptionMode = EnergyConsumptionMode.Drain;
            EnergyConsumptionRate = 1;
            EnergyRechargeRate = 0.2;

            _jetTimer = new Animation { CompletedDelegate = JetEmit };
            _jetTimerGroup = new AnimationGroup(_jetTimer, 10) { Loops = true };

            _jetSound = Storage.Sound("Jet").CreateInstance();
            _jetSound.IsLooped = true;
            _jetSound.Volume = 0.0f;
        }
Beispiel #5
0
        public Shield(Player player)
            : base(player)
        {
            Modifier = 0.5;

            Energy = TotalEnergy = 200;
            EnergyConsumptionMode = EnergyConsumptionMode.Drain;
            EnergyConsumptionRate = 1;
            EnergyRechargeRate = 0.4;

            _shieldSound = Storage.Sound("Shield").CreateInstance();
            _shieldSound.IsLooped = true;
            _shieldSound.Volume = 0.0f;

            _animation = new Animation(this, "GrayLevel", 0.5f, 1.0f);
            _animationGroup = new AnimationGroup(_animation, 200) { Loops = true };
            Storage.AnimationController.AddGroup(_animationGroup);
        }
Beispiel #6
0
        /// <summary>
        /// Click on the "Delete" button. It delete the selected animation group.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteAnimationButton_Click(object sender, EventArgs e)
        {
            int selectedIndex = animationListBox.SelectedIndex;

            if (selectedIndex < 0)
            {
                return;
            }

            AnimationGroup selectedItem = (AnimationGroup)animationListBox.SelectedItem;

            // delete item
            selectedItem.DeleteFromData();

            // update list
            animationGroups.Remove(selectedItem);
            animationGroups.SaveToData();
            animationListBinding.ResetBindings(false);

            // get new selected item at the current index, if any
            selectedIndex = Math.Min(selectedIndex, animationListBox.Items.Count - 1);
            selectedItem  = selectedIndex < 0 ? null : (AnimationGroup)animationListBox.Items[selectedIndex];
            animationListBox.SelectedItem = selectedItem;
        }
Beispiel #7
0
        private void Awake()
        {
            if (HasLoaded)
            {
                return;
            }

            var archivePaths = Config.GetPaths("archive_paths");

            IArchive[] archives;
            using (Utilities.Profiler.Start("Archive load time")) {
                archives = archivePaths.Select(x =>
                                               File.Exists(x) ? (IArchive)ArchiveManager.LoadImageArchive(x)
                    : Directory.Exists(x) ? ArchiveManager.LoadLooseArchive(x)
                    : null).Where(x => x != null).ToArray();
            }

            using (Utilities.Profiler.Start("Collision load time")) {
                foreach (var archive in archives)
                {
                    foreach (var colFile in archive.GetFileNamesWithExtension(".col"))
                    {
                        CollisionFile.Load(colFile);
                    }
                }
            }

            using (Utilities.Profiler.Start("Item info load time")) {
                foreach (var path in Config.GetPaths("item_paths"))
                {
                    var ext = Path.GetExtension(path).ToLower();
                    switch (ext)
                    {
                    case ".dat":
                        Item.ReadLoadList(path); break;

                    case ".ide":
                        Item.ReadIde(path); break;

                    case ".ipl":
                        Item.ReadIpl(path); break;
                    }
                }
            }

            using (Utilities.Profiler.Start("Handling info load time")) {
                Handling.Load(Config.GetPath("handling_path"));
            }

            using (Utilities.Profiler.Start("Animation group info load time")) {
                foreach (var path in Config.GetPaths("anim_groups_paths"))
                {
                    AnimationGroup.Load(path);
                }
            }

            using (Utilities.Profiler.Start("Car color info load time")) {
                CarColors.Load(Config.GetPath("car_colors_path"));
            }

            HasLoaded = true;
        }
Beispiel #8
0
        internal static void ScaleZFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                var visual = ElementCompositionPreview.GetElementVisual(element);

                visual.CenterPoint = element.GetTransformCenter(settings);
                visual.Scale       = new Vector3(visual.Scale.X, visual.Scale.Y, (float)settings.ScaleZ);

                return(animGroup.CreateScalarAnimation <ScaleZAnimation>(
                           element,
                           settings,
                           to: 1f));
            });
        }
Beispiel #9
0
 public bool HasAnimation(RoleAnimationType type)
 {
     return(AnimationGroup.GetAnimationData(type) != null);
 }
Beispiel #10
0
        /// <summary>
        ///     Sends all clients the given information for this avatar
        /// </summary>
        /// <param name="animations"></param>
        /// <param name="sequenceNums"></param>
        /// <param name="objectIDs"></param>
        public void SendAnimPack(UUID[] animations, int[] sequenceNums, UUID[] objectIDs)
        {
            if (m_scenePresence.IsChildAgent)
                return;

            AnimationGroup anis = new AnimationGroup
                                      {
                                          Animations = animations,
                                          SequenceNums = sequenceNums,
                                          ObjectIDs = objectIDs,
                                          AvatarID = m_scenePresence.UUID
                                      };

            m_scenePresence.Scene.ForEachScenePresence(
                presence => presence.SceneViewer.QueuePresenceForAnimationUpdate(presence, anis));
        }
Beispiel #11
0
        static void ParseTranslationTrack(FileReader reader, Header header, Track track, AnimationGroup group)
        {
            switch (track.OpCode)
            {
            case 0x06:
            {
                for (int f = 0; f < header.FrameCount; f++)
                {
                    float   frame = f;
                    float[] loc   = reader.ReadSingles(3);
                    group.TranslateX.AddKey(frame, loc[0]);
                    group.TranslateY.AddKey(frame, loc[1]);
                    group.TranslateZ.AddKey(frame, loc[2]);
                }
            }
            break;

            case 0x08:
            {
                for (int f = 0; f < header.FrameCount; f++)
                {
                    float   frame = f;
                    float[] loc   = reader.ReadHalfSingles(3);
                    group.TranslateX.AddKey(frame, loc[0]);
                    group.TranslateY.AddKey(frame, loc[1]);
                    group.TranslateZ.AddKey(frame, loc[2]);
                }
            }
            break;

            case 0x9:
            {
                uint count = reader.ReadUInt32();
                for (int f = 0; f < count; f++)
                {
                    float   frame = (f * count) / header.FrameCount;
                    float[] loc   = reader.ReadSingles(3);
                    group.TranslateX.AddKey(frame, loc[0]);
                    group.TranslateY.AddKey(frame, loc[1]);
                    group.TranslateZ.AddKey(frame, loc[2]);
                }
            }
            break;

            case 0xA:
            {
                uint count = reader.ReadUInt16();
                for (int f = 0; f < count; f++)
                {
                    float   frame = (f * count) / header.FrameCount;
                    float[] loc   = reader.ReadHalfSingles(3);
                    group.TranslateX.AddKey(frame, loc[0]);
                    group.TranslateY.AddKey(frame, loc[1]);
                    group.TranslateZ.AddKey(frame, loc[2]);
                }
            }
            break;

            case 0xB:
            {
                float[] loc = reader.ReadSingles(3);
                group.TranslateX.AddKey(0, loc[0]);
                group.TranslateY.AddKey(0, loc[1]);
                group.TranslateZ.AddKey(0, loc[2]);
            }
            break;

            case 0xC:
            {
                float[] loc = reader.ReadHalfSingles(3);
                group.TranslateX.AddKey(0, loc[0]);
                group.TranslateY.AddKey(0, loc[1]);
                group.TranslateZ.AddKey(0, loc[2]);
            }
            break;

            case 0xD:
            {
                uint axis  = reader.ReadUInt32();
                var  unk   = reader.ReadBytes(8);
                uint count = reader.ReadUInt32();
                for (int f = 0; f < count; f++)
                {
                    float frame = (f * count) / header.FrameCount;
                    float value = reader.ReadSingle();

                    var loc = new Vector3(0, 0, 0);
                    if (axis == 0)
                    {
                        loc = new Vector3(value, 0, 0);
                    }
                    else if (axis == 1)
                    {
                        loc = new Vector3(0, value, 0);
                    }
                    else if (axis == 2)
                    {
                        loc = new Vector3(0, 0, value);
                    }

                    group.TranslateX.AddKey(0, loc.X);
                    group.TranslateY.AddKey(0, loc.Y);
                    group.TranslateZ.AddKey(0, loc.Z);
                }
            }
            break;

            case 0xE:
            {
                uint   unk1  = reader.ReadUInt32();
                ushort unk2  = reader.ReadUInt16();
                ushort count = reader.ReadUInt16();
                for (int f = 0; f < count; f++)
                {
                    float frame     = (f * count) / header.FrameCount;
                    float positionX = reader.ReadHalfSingle();
                    var   loc       = new Vector3(positionX, 0, 0);
                    group.TranslateX.AddKey(0, loc.X);
                    group.TranslateY.AddKey(0, loc.Y);
                    group.TranslateZ.AddKey(0, loc.Z);
                }
            }
            break;
            }
        }
        public string GetAnimName(AnimGroup group, AnimIndex anim)
        {
            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);

            return(animGroup[anim]);
        }
Beispiel #13
0
 public AnimationGroupEditor(string path)
 {
     AGroup = new AnimationGroup(path);
     InitializeComponent();
 }
Beispiel #14
0
 /// <summary>
 ///   Once the packet has been sent, allow newer animations to be sent for the given entity
 /// </summary>
 /// <param name = "ID"></param>
 public void FinishedAnimationPacketSend(AnimationGroup update)
 {
     //m_AnimationsInPacketQueue.Remove(update.AvatarID);
 }
Beispiel #15
0
        internal static void TranslateXFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                var visual = ElementCompositionPreview.GetElementVisual(element);

                // Since Translation doesn't exist as a property on Visual, we try to fetch it from the PropertySet
                if (visual.Properties.TryGetVector3(TargetProperties.Translation, out var translation) == CompositionGetValueStatus.Succeeded)
                {
                    visual.Properties.InsertVector3(TargetProperties.Translation, new Vector3((float)settings.OffsetX.GetCalculatedOffset(element, OffsetTarget.X), translation.Y, translation.Z));
                }
                else
                {
                    visual.Properties.InsertVector3(TargetProperties.Translation, new Vector3((float)settings.OffsetX.GetCalculatedOffset(element, OffsetTarget.X), 0f, 0f));
                }

                return(animGroup.CreateScalarAnimation <TranslateXAnimation>(
                           element,
                           settings,
                           to: 0f));
            });
        }
Beispiel #16
0
 internal static void TranslateYTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
 {
     group.CreateAnimations(element, settings,
                            animGroup =>
                            animGroup.CreateScalarAnimation <TranslateYAnimation>(
                                element,
                                settings,
                                to: settings.OffsetY.GetCalculatedOffset(element, OffsetTarget.Y)));
 }
Beispiel #17
0
 internal static void ScaleYTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
 {
     group.CreateAnimations(element, settings,
                            animGroup =>
                            animGroup.CreateScalarAnimation <ScaleYAnimation>(
                                element,
                                settings,
                                to: (float)settings.ScaleY));
 }
        public async ValueTask CreateScene()
        {
            var canvas = await Canvas.GetElementById(
                "game-window"
                );

            var engine = await Engine.NewEngine(
                canvas,
                true
                );

            var scene = await Scene.NewScene(
                engine
                );

            var light0 = await PointLight.NewPointLight(
                "Omni",
                await Vector3.NewVector3(
                    0,
                    100,
                    8
                    ),
                scene
                );

            var light1 = await HemisphericLight.NewHemisphericLight(
                "HemisphericLight",
                await Vector3.NewVector3(
                    0,
                    100,
                    8
                    ),
                scene
                );

            var advancedTexture = await AdvancedDynamicTexture.CreateFullscreenUI("UI");

            var UiPanel = await StackPanel.NewStackPanel("name");

            await UiPanel.set_width("220px");

            await UiPanel.set_fontSize("14px");

            await UiPanel.set_horizontalAlignment(await Control.get_HORIZONTAL_ALIGNMENT_RIGHT());

            await UiPanel.set_verticalAlignment(await Control.get_VERTICAL_ALIGNMENT_CENTER());

            await advancedTexture.addControl(UiPanel);

            var house = await SceneLoader.ImportMesh(
                null,
                "assets/",
                "Player.glb",
                scene,
                new Server.Interop.Callbacks.ActionCallback <AbstractMesh[], IParticleSystem[], Skeleton[], AnimationGroup[]>(async(arg1, arg2, arg3, arg4) =>
            {
                foreach (var animation in arg4)
                {
                    await animation.stop();
                    _animationMap.Add(await animation.get_name(), animation);
                    await AddRunAnimationButton(
                        UiPanel,
                        await animation.get_name()
                        );
                }
                if (_animationMap.Count > 0)
                {
                    _runningAnimation = _animationMap.First().Value;
                    await _runningAnimation.start(true);
                }
            })
                );

            var camera = await ArcRotateCamera.NewArcRotateCamera(
                "ArcRotateCamera",
                (decimal)(System.Math.PI / 2),
                (decimal)(System.Math.PI / 4),
                3,
                await Vector3.NewVector3(0, 1, 0),
                scene
                );

            await camera.set_lowerRadiusLimit(2);

            await camera.set_upperRadiusLimit(10);

            await camera.set_wheelDeltaPercentage(0.01m);

            await scene.set_activeCamera(camera);

            await camera.attachControl(
                canvas,
                false
                );

            await engine.runRenderLoop(() => Task.Run(() => scene.render(true, false)));

            _engine = engine;
        }
Beispiel #19
0
 protected void SetupAnimation()
 {
     Animations = new AnimationGroup(AnimationFor);
 }
Beispiel #20
0
 internal static void TranslateZTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
 {
     group.CreateAnimations(element, settings,
                            animGroup =>
                            animGroup.CreateScalarAnimation <TranslateZAnimation>(
                                element,
                                settings,
                                to: (float)settings.OffsetZ));
 }
Beispiel #21
0
        // ====================
        // ROTATE
        // ====================

        internal static void RotateTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
                                   animGroup.CreateScalarAnimation <RotateAnimation>(
                                       element,
                                       settings,
                                       to: settings.Rotation));
        }
        public void CreateScene()
        {
            var canvas = Canvas.GetElementById(
                "game-window"
                );
            var engine = new Engine(
                canvas,
                true
                );
            var scene = new Scene(
                engine
                );

            scene.clearColor = new Color4(0, 0, 0, 0);
            var light0 = new PointLight(
                "Omni",
                new Vector3(
                    0,
                    100,
                    8
                    ),
                scene
                );
            var light1 = new HemisphericLight(
                "HemisphericLight",
                new Vector3(
                    0,
                    100,
                    8
                    ),
                scene
                );
            var advancedTexture = AdvancedDynamicTexture.CreateFullscreenUI("UI");
            var UiPanel         = new StackPanel("name")
            {
                width               = "220px",
                fontSize            = "14px",
                horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_RIGHT,
                verticalAlignment   = Control.VERTICAL_ALIGNMENT_CENTER
            };

            advancedTexture.addControl(UiPanel);

            var house = SceneLoader.ImportMesh(
                null,
                "assets/",
                "Player.glb",
                scene,
                new Interop.Callbacks.ActionCallback <AbstractMesh[], IParticleSystem[], Skeleton[], AnimationGroup[], TransformNode[], Geometry[], Light[]>((arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
            {
                foreach (var animation in arg4)
                {
                    animation.stop();
                    _animationMap.Add(animation.name, animation);
                    AddRunAnimationButton(
                        UiPanel,
                        animation.name
                        );
                }
                if (_animationMap.Count > 0)
                {
                    _runningAnimation = _animationMap.First().Value;
                    _runningAnimation.start(true);
                }
                return(Task.CompletedTask);
            })
                );
            var camera = new ArcRotateCamera(
                "ArcRotateCamera",
                (decimal)(System.Math.PI / 2),
                (decimal)(System.Math.PI / 4),
                3,
                new Vector3(0, 1, 0),
                scene
                )
            {
                lowerRadiusLimit     = 2,
                upperRadiusLimit     = 10,
                wheelDeltaPercentage = 0.01m
            };

            scene.activeCamera = camera;
            camera.attachControl(
                false
                );
            engine.runRenderLoop(new ActionCallback(
                                     () => Task.Run(() => scene.render(true, false))
                                     ));

            _engine = engine;
        }
Beispiel #23
0
        internal static void RotateFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                var visual = ElementCompositionPreview.GetElementVisual(element);

                visual.CenterPoint            = element.GetTransformCenter(settings);
                visual.RotationAngleInDegrees = (float)settings.Rotation;

                return(animGroup.CreateScalarAnimation <RotateAnimation>(
                           element,
                           settings,
                           to: 0));
            });
        }
Beispiel #24
0
        /// <summary>
        ///   This method is called by the LLUDPServer and should never be called by anyone else
        ///   It loops through the available updates and sends them out (no waiting)
        /// </summary>
        /// <param name = "numUpdates">The number of updates to send</param>
        public void SendPrimUpdates(int numPrimUpdates, int numAvaUpdates)
        {
            if (m_numberOfLoops < NUMBER_OF_LOOPS_TO_WAIT)
            //Wait for the client to finish connecting fully before sending out bunches of updates
            {
                m_numberOfLoops++;
                return;
            }

            if (m_inUse || m_presence.IsInTransit)
            {
                return;
            }

            m_inUse = true;
            //This is for stats
            int AgentMS = Util.EnvironmentTickCount();

            #region New client entering the Scene, requires all objects in the Scene

            ///If we havn't started processing this client yet, we need to send them ALL the prims that we have in this Scene (and deal with culling as well...)
            if (!m_SentInitialObjects && m_presence.DrawDistance != 0.0f)
            {
                SendInitialObjects();
            }

            int presenceNumToSend       = numAvaUpdates;
            List <EntityUpdate> updates = new List <EntityUpdate>();
            lock (m_presenceUpdatesToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_presenceUpdatesToSend.Count != 0)
                {
                    try
                    {
#if UseDictionaryForEntityUpdates
                        Dictionary <uint, EntityUpdate> .Enumerator e = m_presenceUpdatesToSend.GetEnumerator();
                        e.MoveNext();
                        List <uint> entitiesToRemove = new List <uint>();
#endif
                        int count = m_presenceUpdatesToSend.Count > presenceNumToSend
                                        ? presenceNumToSend
                                        : m_presenceUpdatesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
#if UseRemovingEntityUpdates
                            EntityUpdate update = ((EntityUpdate)m_presenceUpdatesToSend[0]);

                            /*if (m_EntitiesInPacketQueue.Contains (update.Entity.UUID))
                             * {
                             *  m_presenceUpdatesToSend.RemoveAt (0);
                             *  m_presenceUpdatesToSend.Insert (m_presenceUpdatesToSend.Count, update.Entity.UUID, update);
                             *  continue;
                             * }
                             * m_EntitiesInPacketQueue.Add (update.Entity.UUID);*/
                            m_presenceUpdatesToSend.RemoveAt(0);
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else
                            {
                                updates.Add(update);
                            }
#elif UseDictionaryForEntityUpdates
                            EntityUpdate update = e.Current.Value;
                            entitiesToRemove.Add(update.Entity.LocalId); //Remove it later
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else
                            {
                                updates.Add(update);
                            }
                            e.MoveNext();
#else
                            EntityUpdate update = m_presenceUpdatesToSend.Dequeue();
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else
                            {
                                updates.Add(update);
                            }
#endif
                        }
#if UseDictionaryForEntityUpdates
                        foreach (uint id in entitiesToRemove)
                        {
                            m_presenceUpdatesToSend.Remove(id);
                        }
#endif
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            if (updates.Count != 0)
            {
                presenceNumToSend -= updates.Count;
                m_presence.ControllingClient.SendAvatarUpdate(updates);
            }
            updates.Clear();

            List <AnimationGroup> animationsToSend = new List <AnimationGroup>();
            lock (m_presenceAnimationsToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_presenceAnimationsToSend.Count != 0 && presenceNumToSend > 0)
                {
                    try
                    {
                        int count = m_presenceAnimationsToSend.Count > presenceNumToSend
                                        ? presenceNumToSend
                                        : m_presenceAnimationsToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            AnimationGroup update = m_presenceAnimationsToSend.Dequeue();

                            /*if (m_AnimationsInPacketQueue.Contains (update.AvatarID))
                             * {
                             *  m_presenceAnimationsToSend.RemoveAt (0);
                             *  m_presenceAnimationsToSend.Insert (m_presenceAnimationsToSend.Count, update.AvatarID, update);
                             *  continue;
                             * }
                             * m_AnimationsInPacketQueue.Add (update.AvatarID);*/
                            animationsToSend.Add(update);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            foreach (AnimationGroup update in animationsToSend)
            {
                m_presence.ControllingClient.SendAnimations(update);
            }
            animationsToSend.Clear();

            int primsNumToSend = numPrimUpdates;

            List <IEntity> entities = new List <IEntity>();
            lock (m_objectPropertiesToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_objectPropertiesToSend.Count != 0)
                {
                    try
                    {
                        int count = m_objectPropertiesToSend.Count > primsNumToSend
                                        ? primsNumToSend
                                        : m_objectPropertiesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            ISceneChildEntity entity = ((ISceneChildEntity)m_objectPropertiesToSend[0]);

                            /*if (m_PropertiesInPacketQueue.Contains (entity.UUID))
                             * {
                             *  m_objectPropertiesToSend.RemoveAt (0);
                             *  m_objectPropertiesToSend.Insert (m_objectPropertiesToSend.Count, entity.UUID, entity);
                             *  continue;
                             * }
                             * m_PropertiesInPacketQueue.Add (entity.UUID);*/
                            m_objectPropertiesToSend.RemoveAt(0);
                            entities.Add(entity);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            if (entities.Count > 0)
            {
                primsNumToSend -= entities.Count;
                m_presence.ControllingClient.SendObjectPropertiesReply(entities);
            }

            updates = new List <EntityUpdate>();
            lock (m_objectUpdatesToSendLock)
            {
                if (m_objectUpdatesToSend.Count != 0)
                {
                    try
                    {
                        int count = m_objectUpdatesToSend.Count > primsNumToSend
                                        ? primsNumToSend
                                        : m_objectUpdatesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            EntityUpdate update = ((EntityUpdate)m_objectUpdatesToSend[0]);

                            /*if (m_EntitiesInPacketQueue.Contains (update.Entity.UUID))
                             * {
                             *  m_objectUpdatesToSend.RemoveAt (0);
                             *  m_objectUpdatesToSend.Insert (m_objectUpdatesToSend.Count, update.Entity.UUID, update);
                             *  continue;
                             * }
                             * m_EntitiesInPacketQueue.Add (update.Entity.UUID);*/

                            //Fix the CRC for this update
                            //Increment the CRC code so that the client won't be sent a cached update for this
                            if (update.Flags != PrimUpdateFlags.PrimFlags)
                            {
                                ((ISceneChildEntity)update.Entity).CRC++;
                            }

                            updates.Add(update);
                            m_objectUpdatesToSend.RemoveAt(0);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running object loop: {0}", ex);
                    }
                    m_presence.ControllingClient.SendPrimUpdate(updates);
                }
            }


            //Add the time to the stats tracker
            IAgentUpdateMonitor reporter =
                (IAgentUpdateMonitor)
                m_presence.Scene.RequestModuleInterface <IMonitorModule>().GetMonitor(
                    m_presence.Scene.RegionInfo.RegionID.ToString(), MonitorModuleHelper.AgentUpdateCount);
            if (reporter != null)
            {
                reporter.AddAgentTime(Util.EnvironmentTickCountSubtract(AgentMS));
            }

            m_inUse = false;
        }
Beispiel #25
0
        // ====================
        // BLUR
        // ====================

        internal static void BlurTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
                                   animGroup.CreateEffectAnimation <BlurAnimation, double>(
                                       element,
                                       settings,
                                       to: settings.BlurRadius));
        }
 private void SetupOtherAnimations()
 {
     HelmAnimations   = new AnimationGroup(AnimationFor);
     WeaponAnimations = new AnimationGroup(AnimationFor);
     SetAnimationTexture(WeaponAnimations, ClansGame.Weapons_1);
 }
Beispiel #27
0
        internal static void BlurFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                animGroup.CreateEffectAnimation <BlurAnimation, double>(
                    element,
                    settings,
                    to: settings.BlurRadius,
                    duration: 1,
                    isFrom: true);

                return(animGroup.CreateEffectAnimation <BlurAnimation, double>(
                           element,
                           settings,
                           to: 0));
            });
        }
        public async Task CreateSceneAsync()
        {
            var canvas = await Canvas.GetElementById(
                "game-window"
                );

            var engine = await Engine.NewEngine(
                canvas,
                true
                );

            // This creates a basic Babylon Scene object (non-mesh)
            var scene = await Scene.NewScene(engine);

            await scene.set_clearColor(
                await Color4.NewColor4(
                    0.31m,
                    0.48m,
                    0.64m,
                    1
                    )
                );

            //add an arcRotateCamera to the scene
            var camera = await ArcRotateCamera.NewArcRotateCamera(
                "camera",
                await Tools.ToRadians(125),
                await Tools.ToRadians(70), 25,
                await Vector3.NewVector3(0, 3, 0),
                scene
                );

            await camera.set_lowerRadiusLimit(10);

            await camera.set_upperRadiusLimit(40);

            // This attaches the camera to the canvas
            await camera.attachControl(true);

            //array for holding the cannon and "paired" animation group
            var cannonAnimationPairings = new Dictionary <string, string>();

            //array for holding readyToPlay status for the cannons
            var cannonReadyToPlay = new Dictionary <string, int>();

            //Load the tower assets
            var pirateFortImportEntity = await SceneLoader.ImportMeshAsync(
                "",
                "https://models.babylonjs.com/pirateFort/",
                "pirateFort.glb",
                scene
                );

            var pirateFortImport = pirateFortImportEntity.ToEntity <SceneLoaderImportMeshEntity>();
            var meshes           = await pirateFortImport.get_meshes();

            await meshes[0].set_name("pirateFort");
            var   seaMesh = await scene.getMeshByName("sea");

            await(await seaMesh.get_material()).set_needDepthPrePass(true);
            await(await scene.getLightByName("Sun")).set_intensity(12);

            //Load the cannon model and create clones
            var cannonImportResult = (await SceneLoader.ImportMeshAsync(
                                          "",
                                          "https://models.babylonjs.com/pirateFort/",
                                          "cannon.glb",
                                          scene
                                          )).ToEntity <SceneLoaderImportMeshEntity>();
            //remove the top level root node
            var cannonMeshs = await cannonImportResult.get_meshes();

            var cannon = (await cannonMeshs[0].getChildren())[0];
            await cannon.setParent(null);

            await cannonMeshs[0].dispose();

            //set the metadata of each mesh to filter on later
            var cannonMeshes = await cannon.getChildMeshes();

            for (var i = 0; i < cannonMeshes.Length; i++)
            {
                var metadata = await NodeMetadata.NewNodeMetadata();

                await metadata.set_name("cannon");

                await cannonMeshes[i].set_metadata(metadata);
            }

            var importedAnimGroups = await cannonImportResult.get_animationGroups();

            //loop through all imported animation groups and copy the animation curve data to an array.
            var animations = new Animation[importedAnimGroups.Length];

            for (var i = 0; i < importedAnimGroups.Length; i++)
            {
                await importedAnimGroups[i].stop();
                animations[i] = await(await importedAnimGroups[i].get_targetedAnimations())[0].get_animation();
                await importedAnimGroups[i].dispose();
            }

            //create a new animation group and add targeted animations based on copied curve data from the "animations" array.
            var cannonAnimGroup = await AnimationGroup.NewAnimationGroup(
                "cannonAnimGroup"
                );

            await cannonAnimGroup.addTargetedAnimation(
                animations[0],
                (await cannon.getChildMeshes())[1]
                );

            await cannonAnimGroup.addTargetedAnimation(
                animations[1],
                (await cannon.getChildMeshes())[0]
                );

            //create a box for particle emission, position it at the muzzle of the cannon, turn off visibility and parent it to the cannon mesh
            var particleEmitter = await MeshBuilder.CreateBox(
                "particleEmitter",
                new { size = 0.05 },
                scene
                );

            await particleEmitter.set_position(await Vector3.NewVector3(
                                                   0,
                                                   0.76m,
                                                   1.05m
                                                   ));

            await(await particleEmitter.get_rotation()).set_x(await Tools.ToRadians(78.5m));
            await particleEmitter.set_isVisible(false);

            await particleEmitter.setParent(
                (await cannon.getChildMeshes())[1]
                );

            //load particle system from the snippet server and set the emitter to the particleEmitter. Set its stopDuration.
            var baseurl = await Tools.get_BaseUrl();

            var snippetUrl = await ParticleHelper.get_SnippetUrl();

            var smokeBlast = await ParticleHelper.CreateFromSnippetAsync(
                "LCBQ5Y#6",
                scene,
                false,
                await ParticleHelper.get_SnippetUrl()
                );

            await smokeBlast.set_emitter(particleEmitter);

            await smokeBlast.set_targetStopDuration(0.2m);

            //load a cannon blast sound
            var cannonBlastSound = await Sound.NewSound(
                "music",
                "https://assets.babylonjs.com/sound/cannonBlast.mp3",
                scene
                );

            //position and rotation data for the placement of the cannon clones
            var cannonPositionArray = new Vector3[][] {
                new Vector3[]
                {
                    await Vector3.NewVector3(0.97m, 5.52m, 1.79m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(0), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(1.08m, 2.32m, 3.05m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(0), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(1.46m, 2.35m, -0.73m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(90), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(1.45m, 5.52m, -1.66m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(90), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(1.49m, 8.69m, -0.35m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(90), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(-1.37m, 8.69m, -0.39m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(-90), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(0.58m, 4, -2.18m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(180), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(1.22m, 8.69m, -2.5m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(180), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(-1.31m, 2.33m, -2.45m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(180), await Tools.ToRadians(180))
                },

                new Vector3[]
                {
                    await Vector3.NewVector3(-3.54m, 5.26m, -2.12m),
                    await Vector3.NewVector3(await Tools.ToRadians(0), await Tools.ToRadians(-90), await Tools.ToRadians(180))
                }
            };

            //create 10 cannon clones, each with unique position/rotation data. Note that particle systems are cloned with parent meshes
            //also create 10 new animation groups with targeted animations applied to the newly cloned meshes
            for (var i = 0; i < 10; i++)
            {
                var cannonClone = await cannon.clone <AbstractMesh>(
                    "cannonClone" + i
                    );

                await cannonClone.set_position(cannonPositionArray[i][0]);

                await cannonClone.set_rotation(cannonPositionArray[i][1]);

                var cannonAnimGroupClone = await AnimationGroup.NewAnimationGroup(
                    "cannonAnimGroupClone" + i
                    );

                await cannonAnimGroupClone.addTargetedAnimation(
                    await (await cannonAnimGroup.get_targetedAnimations())[0].get_animation(),
                    (await cannonClone.getChildMeshes())[1]);

                await cannonAnimGroupClone.addTargetedAnimation(
                    await (await cannonAnimGroup.get_targetedAnimations())[1].get_animation(),
                    (await cannonClone.getChildMeshes())[0]);

                //store a key/value pair of each clone name and the name of the associated animation group name.
                cannonAnimationPairings[await cannonClone.get_name()] = await cannonAnimGroupClone.get_name();

                //store key/value pair for the cannon name and it's readyToPlay status as 1;
                cannonReadyToPlay[await cannonClone.get_name()] = 1;
            }
            //dispose of the original cannon, animation group, and particle system
            await cannon.dispose();

            await cannonAnimGroup.dispose();

            await smokeBlast.dispose();

            //create an array for all particle systems in the scene, loop through it and stop all systems from playing.
            var smokeBlasts = await scene.get_particleSystems();

            for (var i = 0; i < smokeBlasts.Length; i++)
            {
                await smokeBlasts[i].stop();
            }

            //logic of what happens on a click
            await(await scene.get_onPointerObservable()).add(async(pointerInfo, eventState) =>
            {
                // PointerEventTypes.POINTERDOWN
                if (await pointerInfo.get_type() != 1)
                {
                    return;
                }
                var pickResult = await pointerInfo.get_pickInfo();
                //check if a mesh was picked and if that mesh has specific metadata
                var pickedMesh = await pickResult.get_pickedMesh();
                if (pickedMesh != null &&
                    await pickedMesh.get_metadata() != null)
                {
                    var metadataNode = (await pickedMesh.get_metadata()).ToEntity <NodeMetadata>();
                    if (await metadataNode.get_name() != "cannon")
                    {
                        return;
                    }
                    //find the top level parent (necessary since the cannon is an extra layer below the clone root)
                    var topParent = await(await pickResult.get_pickedMesh()).get_parent();
                    var parent    = await topParent.get_parent();
                    if (parent != null &&
                        await parent.get_name() != null)
                    {
                        topParent = parent;
                    }
                    var name = await topParent.get_name();
                    //wrap all 'play' elements into a check to make sure the cannon can be played.
                    if (cannonReadyToPlay[name] == 1)
                    {
                        //set the readyToPlay status to 0
                        cannonReadyToPlay[name] = 0;
                        //loop through all of the animation groups in the scene and play the correct group based on the top level parent of the picked mesh.
                        var animationToPlay = cannonAnimationPairings[name];
                        for (var i = 0; i < (await scene.get_animationGroups()).Length; i++)
                        {
                            if (await(await scene.get_animationGroups())[i].get_name() == animationToPlay)
                            {
                                await(await scene.get_animationGroups())[i].play();
                                //after the animation has finished, set the readyToPlay status for this cannon to 1;
                                await(await(await scene.get_animationGroups())[i].get_onAnimationGroupEndObservable()).addOnce(async(_, __) =>
                                {
                                    cannonReadyToPlay[await topParent.get_name()] = 1;
                                });
                            }
                        }
                        //loop through all particle systems in the scene, loop through all picked mesh submeshes. if there is a matching mesh and particle system emitter, start the particle system.
                        var childMeshes = await(await pickResult.get_pickedMesh()).getChildMeshes();
                        for (var i = 0; i < smokeBlasts.Length; i++)
                        {
                            for (var j = 0; j < childMeshes.Length; j++)
                            {
                                if (childMeshes[j].___guid == (await smokeBlasts[i].get_emitter()).___guid)
                                {
                                    await smokeBlasts[i].start();
                                }
                            }
                        }
                        await cannonBlastSound.play();
                    }
                }
            });
            //scene.onPointerDown = function(evt, pickResult) {
            //    //check if a mesh was picked and if that mesh has specific metadata
            //    if (pickResult.pickedMesh && pickResult.pickedMesh.metadata === "cannon")
            //    {
            //        //find the top level parent (necessary since the cannon is an extra layer below the clone root)
            //        var topParent = pickResult.pickedMesh.parent;
            //        if (topParent.parent)
            //        {
            //            topParent = topParent.parent;
            //        }

            //        //wrap all 'play' elements into a check to make sure the cannon can be played.
            //        if (cannonReadyToPlay[topParent.name] === 1)
            //        {
            //            //set the readyToPlay status to 0
            //            cannonReadyToPlay[topParent.name] = 0;
            //            //loop through all of the animation groups in the scene and play the correct group based on the top level parent of the picked mesh.
            //            var animationToPlay = cannonAnimationPairings[topParent.name];
            //            for (var i = 0; i < scene.animationGroups.length; i++)
            //            {
            //                if (scene.animationGroups[i].name === animationToPlay)
            //                {
            //                    scene.animationGroups[i].play();
            //                    //after the animation has finished, set the readyToPlay status for this cannon to 1;
            //                    scene.animationGroups[i].onAnimationGroupEndObservable.addOnce(() =>
            //                    {
            //                        cannonReadyToPlay[topParent.name] = 1;
            //                    });
            //                }
            //            }
            //            //loop through all particle systems in the scene, loop through all picked mesh submeshes. if there is a matching mesh and particle system emitter, start the particle system.
            //            var childMeshes = pickResult.pickedMesh.getChildMeshes();
            //            for (var i = 0; i < smokeBlasts.length; i++)
            //            {
            //                for (var j = 0; j < childMeshes.length; j++)
            //                {
            //                    if (childMeshes[j] === smokeBlasts[i].emitter)
            //                    {
            //                        smokeBlasts[i].start();
            //                    }
            //                }
            //            }
            //            cannonBlastSound.play();
            //        }
            //    }
            //};

            _scene = scene;
            await _scene.set_activeCamera(camera);

            await engine.runRenderLoop(new ActionCallback(
                                           () => Task.Run(() => _scene.render(true, false))
                                           ));

            _engine = engine;
        }
Beispiel #29
0
        // ====================
        // SATURATE
        // ====================

        internal static void SaturateTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
                                   animGroup.CreateEffectAnimation <SaturateAnimation, double>(
                                       element,
                                       settings,
                                       to: settings.Saturation));
        }
Beispiel #30
0
        /// <summary>
        /// Plays the animation range.  Currently this is specified in frame number.  May be better
        /// to use normalized time instead.
        /// </summary>
        /// <param name="pAnimName">Animation name</param>
        /// <param name="pRepeat">Play on repeat or not</param>
        /// <param name="pStart">Range start frame</param>
        /// <param name="pEnd">Range end frame</param>
        public void PlayRange(RoleAnimationType pAnimName, bool pRepeat, int pStart, int pEnd)
        {
            if (IsPlaying && CurrentAnimation != null)
            {
                Stop();
            }

            CurrentAnimation = AnimationGroup.GetAnimationData(pAnimName);
            IsRepeatPlay     = pRepeat;

            if (CurrentAnimation != null)
            {
                if (AnimationWillStart != null)
                {
                    AnimationWillStart(CurrentAnimation);
                }

                startFrame = Mathf.Clamp(pStart, 0, CurrentAnimation.FrameCount - 1);

                if (pEnd == -1)
                {
                    endFrame = CurrentAnimation.FrameCount - 1;
                }
                else
                {
                    endFrame = Mathf.Clamp(pEnd, 0, CurrentAnimation.FrameCount - 1);
                }

                animationSpecificSpeedFactor = 1.0f / CurrentAnimation.SpeedScale;
                if (float.IsInfinity(animationSpecificSpeedFactor))
                {
                    animationSpecificSpeedFactor = 1;
                    UnityEngine.Debug.LogError("animationSpecificSpeedFactor is infinity" + "MeshAnimator.PlayRange");
                }

                frameInterval      = 1.0f / ((GpuSkinAnimationGroup)AnimationGroup).Fps;
                nextUpdate         = /*Time.time + */ frameInterval * SpeedFactor * animationSpecificSpeedFactor;
                CurrentFrame       = startFrame;
                m_lastFrame        = -1;
                m_logicTime        = 0;
                wasUpdateSincePlay = false;

                if (CurrentAnimation.FrameCount == 0)
                {
                    normalizedRatio = 0;
                }
                else
                {
                    normalizedRatio = 1.0f / (float)CurrentAnimation.FrameCount;
                }

                SetNormalizedTime();

                IsPlaying = true;

                if (AnimationStarted != null)
                {
                    AnimationStarted(CurrentAnimation);
                }
            }
        }
Beispiel #31
0
        internal static void SaturateFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                animGroup.CreateEffectAnimation <SaturateAnimation, double>(
                    element,
                    settings,
                    to: settings.Saturation,
                    duration: 1,
                    isFrom: true);

                return(animGroup.CreateEffectAnimation <SaturateAnimation, double>(
                           element,
                           settings,
                           to: AnimationSettings.DEFAULT_SATURATION));
            });
        }
        public async ValueTask CreateScene()
        {
            var canvas = await Canvas.GetElementById(
                "game-window"
                );

            var engine = await Engine.NewEngine(
                canvas,
                true
                );

            var scene = await Scene.NewScene(
                engine
                );

            var light0 = await PointLight.NewPointLight(
                "Omni",
                await Vector3.NewVector3(
                    0,
                    100,
                    8
                    ),
                scene
                );

            var light1 = await HemisphericLight.NewHemisphericLight(
                "HemisphericLight",
                await Vector3.NewVector3(
                    0,
                    100,
                    8
                    ),
                scene
                );

            var Player = await SceneLoader.ImportMesh(
                null,
                "assets/",
                "Shark.glb",
                scene,
                new ActionCallback <AbstractMesh[], IParticleSystem[], Skeleton[], AnimationGroup[], TransformNode[], Geometry[], Light[]>(async(arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
            {
                foreach (var animation in arg4)
                {
                    await animation.stop();
                    _animationMap.Add(await animation.get_name(), animation);
                }

                if (_animationMap.Count > 0)
                {
                    _runningAnimation = _animationMap.First().Value;
                    await _runningAnimation.start(true);
                }
            })
                );

            var camera = await ArcRotateCamera.NewArcRotateCamera(
                "ArcRotateCamera",
                (decimal)(System.Math.PI / 2),
                (decimal)(System.Math.PI / 4),
                0,
                await Vector3.NewVector3(0, 1, 0),
                scene
                );

            // This positions the camera
            await camera.setPosition(await Vector3.NewVector3(30, 10, -30));

            await camera.set_lowerRadiusLimit(2);

            await camera.set_upperRadiusLimit(100);

            await camera.set_wheelDeltaPercentage(0.01m);

            await scene.set_activeCamera(camera);

            await camera.attachControl(
                false
                );

            await engine.runRenderLoop(new ActionCallback(
                                           () => Task.Run(() => scene.render(true, false))
                                           ));

            _engine = engine;
        }
Beispiel #33
0
        internal static void FadeFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                ElementCompositionPreview.GetElementVisual(element).Opacity = (float)settings.Opacity;

                return(animGroup.CreateScalarAnimation <FadeAnimation>(
                           element,
                           settings,
                           to: 1));
            });
        }
Beispiel #34
0
        /// <summary>
        ///     Send an animation update to the given client
        /// </summary>
        /// <param name="client"></param>
        public void SendAnimPackToClient(IClientAPI client)
        {
            if (m_scenePresence.IsChildAgent)
                return;

            UUID[] animations;
            int[] sequenceNums;
            UUID[] objectIDs;

            m_animations.GetArrays(out animations, out sequenceNums, out objectIDs);
            AnimationGroup anis = new AnimationGroup
                                      {
                                          Animations = animations,
                                          SequenceNums = sequenceNums,
                                          ObjectIDs = objectIDs,
                                          AvatarID = m_scenePresence.ControllingClient.AgentId
                                      };
            m_scenePresence.Scene.GetScenePresence(client.AgentId).SceneViewer.QueuePresenceForAnimationUpdate(
                m_scenePresence, anis);
        }
Beispiel #35
0
        // ====================
        // TINT
        // ====================

        internal static void TintTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
                                   animGroup.CreateEffectAnimation <TintAnimation, Color>(
                                       element,
                                       settings,
                                       to: settings.Tint));
        }
 public static void LoadAnimClip(ref AnimationGroup refAnim)
 {
     cachedAnim_clips.animation_clip = new animation_clip[1];
     cachedAnim_clips.animation_clip[cachedAnim_clips.animation_clip.Length - 1].name  = refAnim.Name;
     cachedAnim_clips.animation_clip[cachedAnim_clips.animation_clip.Length - 1].start = 0;
 }
Beispiel #37
0
        internal static void TintFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group)
        {
            group.CreateAnimations(element, settings,
                                   animGroup =>
            {
                animGroup.CreateEffectAnimation <TintAnimation, Color>(
                    element,
                    settings,
                    to: settings.Tint,
                    duration: 1,
                    isFrom: true);

                return(animGroup.CreateEffectAnimation <TintAnimation, Color>(
                           element,
                           settings,
                           to: AnimationSettings.DEFAULT_TINT));
            });
        }