Пример #1
0
        public IAnimGraphNode AddAnim(AnimatedSprite anim)
        {
            AnimGraphNode node = new AnimGraphNode(this, anim);

            m_nodeList.Add(node);

            return node;
        }
Пример #2
0
            public virtual bool HandleMessage(Message msg)
            {
                bool handledMessage = true;
                if (m_nextNodesOnMessage.ContainsKey(msg.Type) == true)
                {
                    m_graph.SetCurrentNode(m_nextNodesOnMessage[msg.Type]);
                    m_nextNodeOnAnimEnd = m_defaultNextNodeOnAnimEnd;

                    //IvyGame.Get().ConsoleStr += " Handled Message: " + msg.Type + " in " + Anim.Name + "\n";
                }
                else if (m_altNextNodesOnAnimEnd.ContainsKey(msg.Type) == true)
                {
                    m_nextNodeOnAnimEnd = m_altNextNodesOnAnimEnd[msg.Type];

                    //IvyGame.Get().ConsoleStr += " Handled Message: " + msg.Type + " in " + Anim.Name + "\n";
                }
                else
                {
                    handledMessage = false;
                }

                return handledMessage;
            }
Пример #3
0
 public void AnimatedSpriteEnd(AnimatedSprite anim)
 {
     if ((m_graph.GetCurrentNode() == this) && (m_nextNodeOnAnimEnd != null))
     {
         m_graph.SetCurrentNode(m_nextNodeOnAnimEnd);
         m_nextNodeOnAnimEnd = m_defaultNextNodeOnAnimEnd;
     }
 }
Пример #4
0
            public virtual bool AddTransitionOnAnimEnd(MessageType msgType, AnimGraphNode nextNode)
            {
                bool added = false;
                if (m_altNextNodesOnAnimEnd.ContainsKey(msgType) == false)
                {
                    m_altNextNodesOnAnimEnd.Add(msgType, nextNode);
                    added = true;
                }

                return added;
            }
Пример #5
0
            public virtual bool AddTransitionOnAnimEnd(AnimGraphNode nextNode)
            {
                m_defaultNextNodeOnAnimEnd = nextNode;
                m_nextNodeOnAnimEnd = m_defaultNextNodeOnAnimEnd;

                return true;
            }
Пример #6
0
        public void SetCurrentNode(IAnimGraphNode iNode)
        {
            AnimGraphNode node = GetNode(iNode);

            // set node to current node
            if (node != null)
            {
                if (m_currentNode != null)
                {
                    //IvyGame.Get().ConsoleStr += "Change Node: " + m_currentNode.Anim.Name + " -> " + node.Anim.Name + "\n";
                    m_currentNode.Anim.Stop();

                    // a hack for syncing animations
                    // TODO: expose some way of turning this sync 'off'
                    //if (m_currentNode.Anim != node.Anim)
                    {
                        node.Anim.Reset();
                    }
                }

                m_currentNode = node;
                m_currentNode.Anim.Play();
            }
            else
            {
                // TODO: error
            }
        }