コード例 #1
0
 public override void OnRemove()
 {
     if (highlighter != null)
     {
         highlighter.DoRemoveMe();
     }
 }
コード例 #2
0
        public void DoCollideWith(ISceneObject other, float tpf)
        {
            if (other is Asteroid && (other as Asteroid).Enabled)
            {
                other.DoRemoveMe();

                // nebudou hitovat objekty, ktere jsou uz pod horizontem
                if (other.Center.Y > baze.Position.Y + baze.Size.Height)
                {
                    return;
                }

                int damage = (other as Asteroid).Radius / 2;

                // score
                Player otherPlayer = baze.SceneMgr.GetOtherActivePlayer(baze.Owner.GetId());
                if (otherPlayer != null && otherPlayer.IsCurrentPlayer())
                {
                    Vector textPos = new Vector(otherPlayer.GetBaseLocation().X + (otherPlayer.GetBaseLocation().Width / 2), otherPlayer.GetBaseLocation().Y - 20);
                    baze.SceneMgr.FloatingTextMgr.AddFloatingText(damage * ScoreDefines.DAMAGE_DEALT, textPos, FloatingTextManager.TIME_LENGTH_2,
                                                                  FloatingTextType.SCORE, FloatingTextManager.SIZE_MEDIUM);
                }

                if (otherPlayer != null && otherPlayer.IsCurrentPlayerOrBot())
                {
                    otherPlayer.AddScoreAndShow(damage * ScoreDefines.DAMAGE_DEALT);
                }

                // damage
                baze.SceneMgr.FloatingTextMgr.AddFloatingText(damage, new Vector((other as Asteroid).Center.X, (other as Asteroid).Center.Y - 10),
                                                              FloatingTextManager.TIME_LENGTH_1, FloatingTextType.DAMAGE, FloatingTextManager.SIZE_MEDIUM);

                SoundManager.Instance.StartPlayingOnce(SharedDef.MUSIC_DAMAGE_TO_BASE);

                baze.Integrity -= damage;
                baze.Owner.Statistics.DamageTaken += damage;

                EmmitorGroup g = ParticleEmmitorFactory.CreateAsteroidExplosionEmmitors(me.SceneMgr, other.Center);
                g.Attach(me.SceneMgr, false);

                if (baze.Owner.IsCurrentPlayer())
                {
                    me.SceneMgr.ScreenShakingMgr.Start(ShakePower.WEAK);
                }

                if (baze.Owner.IsCurrentPlayerOrBot())
                {
                    spawnParticles(other);
                }
            }
        }
コード例 #3
0
 protected override void InitControl(ISceneObject me)
 {
     events.AddEvent(1, new Event(SharedDef.SPECTATOR_ORBITS_TRAVELLING_TIME, EventType.ONE_TIME, new Action(() => { me.DoRemoveMe(); })));
 }