Example #1
0
        public override void Damage(Damage d)
        {
            base.Damage(d);

            Hull.Damage(d.Normal);
            if (Hull.CurrentHitpoints <= 0.0f)
            {
                Kill = true;
            }
        }
Example #2
0
        public override void Damage(Damage d)
        {
            if (Kill)
                return;

            if (Shield != null && Shield.CurrentCharge > 0 && (d.Normal > 0.0f || d.Shield > 0.0f || d.System > 0.0f))
            {
                if (ShieldSound != null && ShieldVisible <= 0.5f)
                    PlaySound(ShieldSound, false);
                ShieldVisible = 1;

                if (!Draw.Contains(ShieldModel))
                    Draw.Add(ShieldModel);
            }

            //damage calculation
            if (Root.Instance.IsAuthoritive)
            {
                float through = 1;
                if (Shield != null && Shield.CurrentCharge > 0.0f)
                {
                    if (d.Shield > 0)
                        through = Math.Max(0.0f, (d.Shield - Shield.CurrentCharge) / d.Shield);
                    else
                        through = 0;
                    Shield.CurrentCharge = Math.Max(0.0f, Shield.CurrentCharge - d.Shield);
                }
                float hp = d.Normal * through + d.ShieldPiercing;
                Hull.Damage(hp);
                Battery.CurrentEnergy = Math.Max(0.0f, Battery.CurrentEnergy - d.System * through);
                if (!ControlsJamed && Battery.CurrentEnergy == 0.0f && (Shield == null || Shield.CurrentCharge <= 0.0f))
                {
                    //Cheetah.Console.WriteLine("control jamed.");
                    ControlsJamed = true;
                }
            }

            UpdateFireTrail();

            if (!Root.Instance.IsAuthoritive)
                return;

            if (Hull.CurrentHitpoints == 0.0f)
            {
                //besser in onkill spawnen?
                Root.Instance.EventSendQueue.Add(new EventReplicationInfo("SpawnExplosion", this));
                SpawnExplosion();
                Kill = true;
            }
        }
Example #3
0
 public override void Damage(Damage d)
 {
     /*Hull.Damage(d.Normal);
     if (Hull.CurrentHitpoints == 0)
     {
         Kill = true;
     }*/
 }
Example #4
0
 public Mine()
 {
     NoReplication = false;
     Draw = new ArrayList();
     Mesh m = Root.Instance.ResourceManager.LoadMesh("mine/mine.mesh");
     Draw.Add(m);
     LifeTime = 60;
     Damage = new Damage(100, 100, 0, 0);
     SyncRefs = false;
     rotationspeed = VecRandom.Instance.NextUnitVector3();
 }
Example #5
0
 public virtual void Damage(Damage d)
 {
 }
Example #6
0
 public HomingMissile()
 {
     Draw = new ArrayList();
     Mesh m = Root.Instance.ResourceManager.LoadMesh("missile/missile.mesh");
     Draw.Add(m);
     //Smoke = new SmokeTrail();
     //Root.Instance.Spa
     LifeTime = 10;
     Damage = new Damage(100, 100, 0, 0);
     Transparent = 1;
     SyncRefs = false;
 }
Example #7
0
 public Nuke()
 {
     Draw = new ArrayList();
     Mesh m = Root.Instance.ResourceManager.LoadMesh("missile/missile.mesh");
     Draw.Add(m);
     LifeTime = 5;
     Damage = new Damage(100, 100, 0, 0);
     Transparent = 1;
     SyncRefs = false;
 }
Example #8
0
        public RailBeam()
        {
            Draw = new ArrayList();
            Mesh m = Root.Instance.ResourceManager.LoadMesh("rail/rail.mesh");
            Draw.Add(new BeamRenderer(15, m, new Vector3(0, 0, 200)));

            LifeTime = 1;
            Damage = new Damage(250, 250, 0, 0);

        }
Example #9
0
        public PulseLaserBeam()
        {
            Draw = new ArrayList();
            Mesh m = Root.Instance.ResourceManager.LoadMesh("laserbeam/laserbeam.mesh");
            Draw.Add(new BeamRenderer(15, m, new Vector3(0, 0, 200)));

            LifeTime = 1;
            Damage = new Damage(30, 30, 0, 0);

        }
Example #10
0
 public IonPulseBeam()
     : base()
 {
     Draw = new ArrayList();
     Mesh m = Root.Instance.ResourceManager.LoadMesh("laser/laser.mesh");
     Draw.Add(m);
     LifeTime = 2;
     Transparent = 1;
     Damage = new Damage(0, 0, 0, 15);
     SyncRefs = false;
 }