Example #1
0
        // Your block initialization
        public void BlockInit()
        {
            // No point to run this script if is a dedicated server because there's no graphics
            if (Anima.DedicatedServer) return;

            // Create the main Anima class
            m_anima = new Anima();

            // Initialize Anima
            if (!m_anima.Init(Entity as MyEntity, "Anima Examples", "AnimaExamples")) throw new ArgumentException("Anima failed to initialize!");

            // Add parts
            m_part_core = m_anima.AddPart(null, @"AnimaExamples\ModelCore");
            m_part_topcap = m_anima.AddPart(m_part_core, @"animaexamples\TopCap");
            m_part_bottomcap = m_anima.AddPart(m_part_core, @"animaexamples\BottomCap");

            // Assign sequences
            coreFunctionality(m_part_core);
            m_part_core.OnComplete = coreFunctionality;

            // Play sequences
            m_anima.Play(Anima.Playback.LOOP);

            // Update each frame, note this may not work for all object's types!
            Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
        }
Example #2
0
 /// <summary>
 /// Anima main class constructor.
 /// </summary>
 public AnimaPart(Anima anima, AnimaPart parent, MyEntity entity)
 {
     m_anima            = anima;
     m_entity           = entity;
     m_parent           = parent;
     m_smoothAnim       = false;
     m_enabled          = true;
     m_visible          = true;
     m_onTransform      = null;
     m_onComplete       = null;
     m_seq              = null;
     m_playMode         = Anima.Playback.HALT;
     m_playMode2        = Anima.Playback.HALT;
     m_cursorPos        = 0f;
     m_speed            = 1f;
     m_lastCursorPos    = 0;
     m_disableRootColor = false;
     m_position         = Vector3.Zero;
     m_rotation         = Quaternion.Identity;
     m_scale            = Vector3.One;
 }
Example #3
0
        // Your block initialization
        public void BlockInit()
        {
            // ( Your initialization code here! )

            // No point to run this script if is a dedicated server because there's no graphics
            if (Anima.DedicatedServer) return;

            // Create the main Anima class
            m_anima = new Anima();

            // Initialize Anima
            if (!m_anima.Init(Entity as MyEntity, "Anima Examples", "AnimaExamples")) throw new ArgumentException("Anima failed to initialize!");

            // Add parts
            m_part = m_anima.AddPart(null, @"AnimaExamples\ModelCube");

            // Assign sequences
            m_part.Sequence = Seq_Cube.Adquire();

            // Play sequences
            m_part.Play(Anima.Playback.LOOP);
        }
Example #4
0
 /// <summary>
 /// Start playback with normalized cursor.
 /// </summary>
 /// <param name="playMode">any of playback mode, enum of Anima.Playback.</param>
 /// <param name="cursorPos">starting cursor position (normalized between 0 to 1).</param>
 /// <remarks>cursor position will be clamped to animation range.</remarks>
 public void PlayNormal(Anima.Playback playMode, float cursorPos = 0f)
 {
     if (m_entity == null || m_seq == null) return;
     m_playMode = playMode;
     m_playMode2 = playMode;
     if (cursorPos < 0f) cursorPos = 0f;
     else if (cursorPos > 1f) cursorPos = 1f;
     m_cursorPos = cursorPos * m_seq.FramePeriod + m_seq.FrameStart;
     ProcAutoAnimation();
 }
Example #5
0
 /// <summary>
 /// Start playback.
 /// </summary>
 /// <param name="playMode">any of playback mode, enum of Anima.Playback.</param>
 /// <param name="cursorPos">starting cursor position (in keyframes).</param>
 /// <remarks>cursor position will be clamped to animation range.</remarks>
 public void Play(Anima.Playback playMode, float cursorPos = 0f)
 {
     if (m_entity == null || m_seq == null) return;
     m_playMode = playMode;
     m_playMode2 = playMode;
     if (cursorPos < m_seq.FrameStart) cursorPos = m_seq.FrameStart;
     else if (cursorPos > m_seq.FrameEnd) cursorPos = m_seq.FrameEnd;
     m_cursorPos = cursorPos;
     ProcAutoAnimation();
 }
Example #6
0
 /// <summary>
 /// Anima main class constructor.
 /// </summary>
 public AnimaPart(Anima anima, AnimaPart parent, MyEntity entity)
 {
     m_anima = anima;
     m_entity = entity;
     m_parent = parent;
     m_smoothAnim = false;
     m_enabled = true;
     m_visible = true;
     m_onTransform = null;
     m_onComplete = null;
     m_seq = null;
     m_playMode = Anima.Playback.HALT;
     m_playMode2 = Anima.Playback.HALT;
     m_cursorPos = 0f;
     m_speed = 1f;
     m_lastCursorPos = 0;
     m_disableRootColor = false;
     m_position = Vector3.Zero;
     m_rotation = Quaternion.Identity;
     m_scale = Vector3.One;
 }