Esempio n. 1
0
 public void StartAnimation(IAnimation anim, bool animateRoot)
 {
     m_model.Animation = anim;
     m_animStartTime   = Level.TimeMachine.Time;
     m_animateRoot     = animateRoot;
     m_model.AnimTime  = 0.0f;
     m_model.Animate();
     AnimateRoot();
 }
Esempio n. 2
0
        protected override void OnInit()
        {
            if (Tile.Behaviour is SpawnTileBehaviour)
            {
                var spawnTile = (SpawnTileBehaviour)Tile.Behaviour;
                m_ghostModel = new ModelInstance(
                    spawnTile.RobotModel,
                    BuildTransform()
                    );
                var animset = spawnTile.RobotAnimSet;
                if (animset != null)
                {
                    m_ghostModel.Animation = animset.GetAnim("ghost");
                    m_ghostModel.AnimTime  = 0.0f;
                    m_ghostModel.Animate();
                }
            }
            else
            {
                App.Log("Error: Tile {0} does not have spawn behaviour", Tile.Path);
            }

            PushState(new SpawnMarkerState(
                          ESpawnMarkerState.Initial, CurrentTime,
                          1.0f, 1.0f, CurrentTime
                          ));
        }
Esempio n. 3
0
        public SkyInstance(Sky sky)
        {
            m_sky = sky;

            m_litEffect = new LitEffectInstance(sky.RenderPass);
            m_litEffect.AmbientLight = new AmbientLight(Vector3.Zero);
            m_litEffect.Light        = new DirectionalLight(Vector3.UnitY, Vector3.Zero);
            m_litEffect.Light2       = new DirectionalLight(Vector3.UnitY, Vector3.Zero);

            if (m_sky.AnimPath != null)
            {
                m_animation = LuaAnimation.Get(m_sky.AnimPath);
                m_animTime  = 0.0f;
            }
            if (m_sky.ModelPath != null)
            {
                var model = Model.Get(m_sky.ModelPath);
                m_model           = new ModelInstance(model, Matrix4.Identity);
                m_model.Animation = m_animation;
                m_model.AnimTime  = m_animTime;
                m_model.Animate();
            }
            if (m_sky.ForegroundModelPath != null)
            {
                var model = Model.Get(m_sky.ForegroundModelPath);
                m_foregroundModel           = new ModelInstance(model, Matrix4.Identity);
                m_foregroundModel.Animation = m_animation;
                m_foregroundModel.AnimTime  = m_animTime;
                m_foregroundModel.Animate();
            }
            AnimateLights();
        }
Esempio n. 4
0
 private void UpdateAnimation()
 {
     // Animate
     m_modelInstance.Animation = CurrentState.Action.GetAnimation(CurrentState);
     m_modelInstance.AnimTime  = CurrentState.Action.GetAnimTime(CurrentState);
     m_modelInstance.Animate();
 }
Esempio n. 5
0
        public override void Update()
        {
            base.Update();
            if (Level != null)
            {
                var powered = !Level.InEditor && Tile.IsPowered(Level, Location);
                if (powered != m_powered)
                {
                    var behaviour = (AnimatedTileBehaviour)Tile.Behaviour;
                    m_powered = powered;
                    if (m_emitter != null && behaviour.PoweredPFX != behaviour.PFX)
                    {
                        m_emitter.Stop(Level.TimeMachine.RealTime);
                        m_emitter = Level.Particles.Create(ParticleStyle.Get(m_powered ? behaviour.PoweredPFX : behaviour.PFX), false, true);

                        var direction = Tile.GetDirection(Level, Location);
                        m_emitter.Transform = Tile.BuildTransform(Location, direction);
                    }
                }
                if (m_powered && m_poweredModel != null)
                {
                    m_poweredModel.AnimTime = Level.TimeMachine.RealTime;
                    m_poweredModel.Animate();
                }
                else if (m_model != null)
                {
                    m_model.AnimTime = Level.TimeMachine.RealTime;
                    m_model.Animate();
                }
            }
        }
Esempio n. 6
0
 public override void Update()
 {
     base.Update();
     if (m_model != null)
     {
         m_model.AnimTime = GetCurrentDistance();
         m_model.Animate();
     }
 }
Esempio n. 7
0
 public override void Update()
 {
     base.Update();
     if (m_modelInstance.Animation != null)
     {
         m_modelInstance.AnimTime = CurrentTime - SpawnTime;
         m_modelInstance.Animate();
     }
 }
Esempio n. 8
0
        private void UpdateModel()
        {
            if (m_model != null)
            {
                m_model.Transform = Tile.BuildTransform(Location, CurrentState.Direction);

                var   timer    = Level.TimeMachine.Time - CurrentState.TimeStamp;
                float progress = (CurrentState.Mode == TurntableMode.Turn) ?
                                 timer / Robot.Robot.STEP_TIME :
                                 0.0f;
                m_model.AnimTime = progress;
                m_model.Animate();
            }
        }
Esempio n. 9
0
 public void Animate()
 {
     if (m_model != null)
     {
         m_model.Animation = m_animation;
         m_model.Animate();
     }
     if (m_foregroundModel != null)
     {
         m_foregroundModel.Animation = m_animation;
         m_foregroundModel.Animate();
     }
     AnimateLights();
 }
Esempio n. 10
0
        protected override void OnInit()
        {
            var behaviour = ((SpawnTileBehaviour)Tile.Behaviour);

            m_modelInstance = new ModelInstance(
                behaviour.RobotModel,
                BuildTransform()
                );

            var animSet = behaviour.RobotAnimSet;

            if (animSet != null)
            {
                m_modelInstance.Animation = animSet.GetAnim("idle");
                m_modelInstance.AnimTime  = 0.0f;
                m_modelInstance.Animate();
            }
        }
Esempio n. 11
0
 public override void Update()
 {
     base.Update();
     if (m_ghostModel != null)
     {
         if (Tile.Behaviour is SpawnTileBehaviour)
         {
             var spawnTile = (SpawnTileBehaviour)Tile.Behaviour;
             var animset   = spawnTile.RobotAnimSet;
             if (animset != null)
             {
                 m_ghostModel.Animation = Highlight ? animset.GetAnim("ghost_highlight") : animset.GetAnim("ghost");
                 m_ghostModel.AnimTime  = Level.TimeMachine.RealTime;
                 m_ghostModel.Animate();
             }
         }
     }
 }
Esempio n. 12
0
 public override void Update()
 {
     base.Update();
     m_model.AnimTime = Level.TimeMachine.RealTime;
     m_model.Animate();
 }