protected override void OnInit() { var direction = Tile.GetDirection(Level, Location); var behaviour = (TelepadTileBehaviour)Tile.Behaviour; var model = behaviour.GetModel(Level, Location); var transform = Tile.BuildTransform(Location, direction); if (model != null) { m_model = new ModelInstance(model, transform); } Level.Telepads.AddTelepad(behaviour.Colour, Location); if (behaviour.Animation != null) { if (m_model != null) { m_model.Animation = LuaAnimation.Get(behaviour.Animation); m_model.AnimTime = Level.TimeMachine.RealTime; } } if (behaviour.PFX != null) { if (m_model != null) { m_emitter = Level.Particles.Create(ParticleStyle.Get(behaviour.PFX), false, true); m_emitter.Transform = transform; } } }
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(); } } }
protected void StartParticles(string path, bool startActive, bool realTime) { if (!m_particles.ContainsKey(path)) { var style = ParticleStyle.Get(path); var emitter = Level.Particles.Create(style, startActive, realTime); emitter.Transform = Transform; m_particles.Add(path, emitter); } }
protected override void OnInit() { var behaviour = (AnimatedTileBehaviour)Tile.Behaviour; var direction = behaviour.GetModelDirection(Level, Location); var transform = Tile.BuildTransform(Location, direction); m_powered = !Level.InEditor && Tile.IsPowered(Level, Location); var model = behaviour.GetModel(Level, Location); if (model != null) { m_model = new ModelInstance(model, transform); if (behaviour.Animation != null) { m_model.Animation = LuaAnimation.Get(behaviour.Animation); m_model.AnimTime = Level.TimeMachine.RealTime; } } var poweredModel = behaviour.GetPoweredModel(Level, Location); if (poweredModel != null && poweredModel != model) { m_poweredModel = new ModelInstance(poweredModel, transform); if (behaviour.PoweredAnimation != null) { m_poweredModel.Animation = LuaAnimation.Get(behaviour.PoweredAnimation); m_poweredModel.AnimTime = Level.TimeMachine.RealTime; } } if (behaviour.PFX != null) { m_emitter = Level.Particles.Create(ParticleStyle.Get(m_powered ? behaviour.PoweredPFX : behaviour.PFX), false, true); m_emitter.Transform = transform; } }