Пример #1
0
        /// <summary>
        /// This method prints on the console the list of animation tags
        /// </summary>
        private void PrintAnimationNames()
        {
            AnimationStateSet      animStateSet = robot.GameEntity.AllAnimationStates;      // Get the set of animation states in the Entity
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator(); // Iterates through the animation states

            while (animIterator.MoveNext())                                                 // Gets the next animation state in the set
            {
                // Console.WriteLine(animIterator.CurrentKey);                      // Print out the animation name in the current key
            }
        }
Пример #2
0
        private void PrintAnimationNames()
        {
            AnimationStateSet      animStateSet = robotEntity.AllAnimationStates;
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();

            while (animIterator.MoveNext())
            {
                Console.WriteLine(animIterator.CurrentKey);
            }
        }
Пример #3
0
 public void SetActiveAnimationTimePos(float fTime)
 {
     if (HasModelEntity && ModelEntity.HasSkeleton)
     {
         ModelEntity.Skeleton.Reset();
         AnimationStateIterator animationStateIterator = ModelEntity.AllAnimationStates.GetAnimationStateIterator();
         do
         {
             if ((animationStateIterator.Current != null) && animationStateIterator.Current.Enabled)
             {
                 animationStateIterator.Current.TimePosition = fTime;
             }
         }while (animationStateIterator.MoveNext());
     }
 }
Пример #4
0
        private bool IsValidAnimationName(string newName)
        {
            bool nameFound = false;

            AnimationStateSet      animStateSet = robotEntity.AllAnimationStates;
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();

            while (animIterator.MoveNext() && nameFound)
            {
                if (newName == animIterator.CurrentKey)
                {
                    nameFound = true;
                }
            }
            return(nameFound);
        }
Пример #5
0
 private void TearDownPreviousTask()
 {
     mSceneMgr.DestroyAllEntities();
     mSceneMgr.DestroyAllAnimations();
     _playerNode.RemoveAndDestroyAllChildren();
     mSceneMgr.DestroySceneNode(_playerNode);
     _playerEntity = null;
     _playerNode.Dispose();
     _playerNode          = null;
     mAnimationCollection = null;
     mStateIterator       = null;
     mRenderedAnims       = new List <string>();
     mCurrentAnimState    = null;
     mAnimTime            = 0;
     mAnimMaxTime         = 0;
     mFrameCount          = 0;
     currentRenderTask    = null;
 }
Пример #6
0
        /// <summary>
        /// This method deternimes whether the name inserted is in the list of valid animation names
        /// </summary>
        /// <param name="newName">An animation name</param>
        /// <returns></returns>
        private bool IsValidAnimationName(string newName)
        {
            bool nameFound = false;

            AnimationStateSet animStateSet = enemyModel.Robot.GameEntity.AllAnimationStates;

            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();     ///Iterator.currentkey its like indexing a list and has methods that do it for you.


            while (animIterator.MoveNext())
            {
                Console.WriteLine(animIterator.CurrentKey);
            }
            return(nameFound);

            //while (animaIterator.MoveNext())
            //{
            //    Console.WriteLine(animaIterator.CurrentKey);
            //}
            //return nameFound;
        }
Пример #7
0
        protected void BeginNextTask()
        {
            //If we're transitioning from a previous task, lets tear that shit down
            if (currentRenderTask != null)
            {
                TearDownPreviousTask();
            }

            if (currentRenderTask == null && renderTasks.Count == 0)
            {
                mShutDown = true;
                return;
            }

            //Dequeue the next task
            currentRenderTask = renderTasks.Dequeue();

            _playerEntity = mSceneMgr.CreateEntity(currentRenderTask.PlayerModelConfig.EntityName, currentRenderTask.PlayerModelConfig.ModelName);

            _playerNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("PlayerNode");
            _playerNode.AttachObject(_playerEntity);
            _playerNode._setDerivedPosition(_playerNode.Position + new Vector3(0, -0.5f * _playerEntity.BoundingRadius, 0));

            //Set up name of dat animation collection
            var animationCollectionName = currentRenderTask.PlayerModelConfig.EntityName;

            switch (currentRenderTask.TaskType)
            {
            case TaskType.Item:
                animationCollectionName += "_" + currentRenderTask.ItemConfig.EntityName;
                break;

            case TaskType.Wearable:
                animationCollectionName += "_" + currentRenderTask.WearableConfig.EntityName;
                break;
            }

            mAnimationCollection = new AnimationCollection {
                Name = animationCollectionName
            };
            mStateIterator = _playerEntity.AllAnimationStates.GetAnimationStateIterator();

            if (_playerEntity != null)
            {
                switch (currentRenderTask.TaskType)
                {
                case TaskType.Item:
                {
                    _currentItem = mSceneMgr.CreateEntity(currentRenderTask.ItemConfig.EntityName,
                                                          currentRenderTask.ItemConfig.ModelName);
                    var ic = currentRenderTask.ItemConfig;
                    _playerEntity.AttachObjectToBone(currentRenderTask.PlayerModelConfig.RHandBoneName, _currentItem,
                                                     new Quaternion(ic.QuatW, ic.QuatX, ic.QuatY, ic.QuatZ),
                                                     new Vector3(ic.OffsetX, ic.OffsetY, ic.OffsetZ));
                    //Make player entity transparent so all we see is the item
                    _playerEntity.SetMaterialName("transparent_mask");
                }
                break;

                case TaskType.Wearable:
                    _playerEntity.SetMaterialName(currentRenderTask.WearableConfig.Material);
                    break;
                }
            }


            //_ent.SetMaterialName("Normal");

            /*
             * var sub = _ent.GetSubEntity(0);
             * sub.SetCustomParameter(CUSTOM_SHININESS, new Vector4(10.0f, 0.0f, 0.0f, 0.0f));
             * sub.SetCustomParameter(CUSTOM_DIFFUSE, new Vector4(1.0f, 1.0f, 0.7f, 1.0f));
             * sub.SetCustomParameter(CUSTOM_SPECULAR, new Vector4(1.0f, 1.0f, 1.0f, 1.0f));*/
            NextAnimation();
        }
Пример #8
0
 private void TearDownPreviousTask()
 {
     mSceneMgr.DestroyAllEntities();
     mSceneMgr.DestroyAllAnimations();
     _playerNode.RemoveAndDestroyAllChildren();
     mSceneMgr.DestroySceneNode(_playerNode);
     _playerEntity = null;
     _playerNode.Dispose();
     _playerNode = null;
     mAnimationCollection = null;
     mStateIterator = null;
     mRenderedAnims = new List<string>();
     mCurrentAnimState = null;
     mAnimTime = 0;
     mAnimMaxTime = 0;
     mFrameCount = 0;
     currentRenderTask = null;
 }
Пример #9
0
        protected void BeginNextTask()
        {
            //If we're transitioning from a previous task, lets tear that shit down
            if (currentRenderTask != null)
                TearDownPreviousTask();

            if (currentRenderTask == null && renderTasks.Count == 0)
            {
                mShutDown = true;
                return;
            }

            //Dequeue the next task
            currentRenderTask = renderTasks.Dequeue();

            _playerEntity = mSceneMgr.CreateEntity(currentRenderTask.PlayerModelConfig.EntityName, currentRenderTask.PlayerModelConfig.ModelName);

            _playerNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("PlayerNode");
            _playerNode.AttachObject(_playerEntity);
            _playerNode._setDerivedPosition(_playerNode.Position + new Vector3(0, -0.5f * _playerEntity.BoundingRadius, 0));

            //Set up name of dat animation collection
            var animationCollectionName = currentRenderTask.PlayerModelConfig.EntityName;
            switch (currentRenderTask.TaskType)
            {
                case TaskType.Item:
                    animationCollectionName += "_" + currentRenderTask.ItemConfig.EntityName;
                    break;
                case TaskType.Wearable:
                    animationCollectionName += "_" + currentRenderTask.WearableConfig.EntityName;
                    break;
            }

            mAnimationCollection = new AnimationCollection { Name = animationCollectionName };
            mStateIterator = _playerEntity.AllAnimationStates.GetAnimationStateIterator();

            if (_playerEntity != null)
            {
                switch (currentRenderTask.TaskType)
                {
                    case TaskType.Item:
                        {
                            _currentItem = mSceneMgr.CreateEntity(currentRenderTask.ItemConfig.EntityName,
                                                                  currentRenderTask.ItemConfig.ModelName);
                            var ic = currentRenderTask.ItemConfig;
                            _playerEntity.AttachObjectToBone(currentRenderTask.PlayerModelConfig.RHandBoneName, _currentItem,
                                                             new Quaternion(ic.QuatW, ic.QuatX, ic.QuatY, ic.QuatZ),
                                                             new Vector3(ic.OffsetX, ic.OffsetY, ic.OffsetZ));
                            //Make player entity transparent so all we see is the item
                            _playerEntity.SetMaterialName("transparent_mask");
                        }
                        break;
                    case TaskType.Wearable:
                        _playerEntity.SetMaterialName(currentRenderTask.WearableConfig.Material);
                        break;
                }
            }

            //_ent.SetMaterialName("Normal");
            /*
              var sub = _ent.GetSubEntity(0);
              sub.SetCustomParameter(CUSTOM_SHININESS, new Vector4(10.0f, 0.0f, 0.0f, 0.0f));
              sub.SetCustomParameter(CUSTOM_DIFFUSE, new Vector4(1.0f, 1.0f, 0.7f, 1.0f));
              sub.SetCustomParameter(CUSTOM_SPECULAR, new Vector4(1.0f, 1.0f, 1.0f, 1.0f));*/
            NextAnimation();
        }