public override void Update(GameTime gameTime) { if (Vector2.Distance(ParentShip.Position, Target) <= 25.0f) { ParentShip.StopMovement(); Parent.SetState <ShipIdleState>(); } }
public override void Begin() { var ship = (Miner)ParentShip; ship.CurrentMiningTarget = Target; ParentShip.SetDestination(Target.Position); }
public override void Trigger() { if (FactionManager.CanAfford(ParentShip.FactionNumber, 0, 150) && ParentShip.GetOffenseProgress() == 0) { Triggered = true; PauseTime = 0; } base.Trigger(); }
public override void Begin() { if (FollowDistance == 0) { FollowDistance = Target.ShieldRadius * 4.0f; } RandomOffset = new Vector2(WorldData.RNG.Next(-50, 50), WorldData.RNG.Next(-50, 50)); ParentShip.SetDestination(Target.Position + RandomOffset); }
public override void Begin() { var ship = (Miner)ParentShip; ship.CurrentMiningTarget = Target; RandomOffset = new Vector2(WorldData.RNG.Next(-25, 25), WorldData.RNG.Next(-25, 25)); ParentShip.SetDestination(Target.Position + RandomOffset); }
public override void Begin() { if (FollowDistance == 0) { FollowDistance = 50.0f + WorldData.RNG.Next(0, 50); } RandomOffset = new Vector2(WorldData.RNG.Next(-50, 50), WorldData.RNG.Next(-50, 50)); ParentShip.SetDestination(Target + RandomOffset); }
public override void Draw(Vector2 Position, Vector2 Size) { Render.DrawSprite(MyTexture, Position, Size, 0, TeamInfo.HudColors[ParentShip.GetTeam()]); Vector2 SliceSize = TargetSliceSize * Size; Game1.spriteBatch.Draw(SliceTexture, Position - SliceSize / 2, new Rectangle(0, 0, (int)( SliceTexture.Width * Math.Floor(ParentShip.HealthMult() * 50) / 50f), SliceTexture.Height), TeamInfo.HudColors[ParentShip.GetTeam()], 0, Vector2.Zero, SliceSize / new Vector2(SliceTexture.Width, SliceTexture.Height), SpriteEffects.None, 0); base.Draw(Position, Size); }
/// <summary> Fires the weapon once </summary> public void Shoot() { if (reload_timer < ReloadSpeed * 2) { return; } Ammunition current_ammo = ParentShip.CurrentAmmo; if (!ParentShip.SubstractAmmo(current_ammo, 1u) || ooo_time > 0) { return; } if (heat > 1) { ooo_time = init_ooo_time; return; } // Spawn the bullet Bullet.Spawn( current_ammo, Transform.position + (Transform.rotation * ShootPos), Transform.rotation, SceneGlobals.ReferenceSystem.RelativeVelocity(ParentShip.Velocity) + Transform.forward * BulletSpeed, ParentShip.Friendly ); //Spawn Objects Vector3 hull_spawn_pos = Transform.position + (Transform.rotation * EjectPos / 2); GameObject hull_obj = Object.Instantiate(empty_hull, hull_spawn_pos, Transform.rotation * Quaternion.Euler(-90, 0, 0)); hull_obj.name = "Hull: " + current_ammo.ToString(); // Initialize the hull const double hull_mass = 2e-4; // 200g Hull hull_inst = new Hull(hull_obj, hull_mass, SceneGlobals.ReferenceSystem.RelativeVelocity(ParentShip.Velocity)); hull_inst.Velocity -= HullSpeed * EjectPos.normalized; hull_inst.AngularVelocity = HandyTools.RandomVector * 10f; HullAttachment hull_script = Loader.EnsureComponent <HullAttachment>(hull_obj); hull_script.instance = hull_inst; // Plays the sound if (ParentShip.IsPlayer) { Globals.audio.ShootingSound("gettling"); } reload_timer = 0.0f; heat += .05f; }
public override void Update(GameTime gameTime) { if (Vector2.Distance(ParentShip.Position, Target.Position + RandomOffset) <= 50) { ParentShip.StopMovement(); Parent.SetState <MinerDepositingState>(); } else { ParentShip.SetDestination(Target.Position + RandomOffset); } }
public override void Draw(Vector2 Position, Vector2 Size) { if (ProgressAlpha > 0) { Render.DrawSprite(OuterTexture, Position, Size * ProgressAlpha, 0, TeamInfo.HudColors[ParentShip.GetTeam()] * ProgressAlpha); Render.DrawSprite(InnerTexture, Position, Size * ProgressAlpha, ParentShip.GetOffenseProgress() * (float)Math.PI, TeamInfo.HudColors[ParentShip.GetTeam()] * ProgressAlpha); } if (EliminatedAlpha > 0) { Render.DrawSprite(EliminatedTexture, Position, Size * EliminatedAlpha, 0, TeamInfo.HudColors[WaveFSM.PlayerEliminatedState.LastEliminatedTeam] * EliminatedAlpha); } base.Draw(Position, Size); }
public override void Update(GameTime gameTime) { ParentShip.SetDestination(Target.Position); foreach (var weapon in ParentShip.Weapons) { if (Vector2.Distance(Target.Position, ParentShip.Position) <= weapon.Range && weapon.CurrentCooldown <= 0) { Target.TakeDamage(weapon.Damage); weapon.CurrentCooldown = weapon.Cooldown; } } }
public override void Update(GameTime gameTime) { if (ParentShip.CollisionRect.Intersects(Target.CollisionRect)) { ParentShip.StopMovement(); Parent.GetState <MinerMiningState>().Target = Target; Parent.SetState <MinerMiningState>(); } else { ParentShip.SetDestination(Target.Position); } }
private void Activate() { if (!WaveStepState.WeaponsFree) { return; } FactionManager.AddEnergy(ParentShip.FactionNumber, -150); Vector3 Position3 = new Vector3(ParentShip.Position.X(), 0, ParentShip.Position.Y()); float Theta = 0; float Offset = ParentShip.Size.X() * 2; FactionManager.Factions[ParentShip.FactionNumber].roundReport.UnitsSpawned += MyCard.GhostCount; for (int i = 0; i < MyCard.GhostCount; i++) { UnitShip u = (UnitShip)MyCard.GetUnit(ParentShip.FactionNumber); ParentShip.ParentLevel.AddObject(u); while (!ParentShip.TestFree(ParentShip.Position.get(), Theta, Offset, ParentShip.Size.X())) { Theta += (float)Math.PI / 10f; if (Theta > Math.PI * 2) { Theta -= (float)Math.PI * 2; Offset += ParentShip.Size.X(); } } Vector2 BestPosition = Logic.ToVector2(Theta) * Offset + ParentShip.Position.get(); u.SetForGhost(); u.Position.set(BestPosition); u.SetLevel(WaveManager.CurrentWave / 5f * WaveCard.LevelMult, 1); Position3 = new Vector3(BestPosition.X, 0, BestPosition.Y); for (int j = 0; j < 30; j++) { ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5); } } ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), ParentShip.Size.X() * 5, 4); for (int i = 0; i < 30; i++) { ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5); } }
public override void Update() { if (!Exists) { return; } base.Update(); if (particlesystem.isPaused) { particlesystem.Play(); } ParentShip.DrainFuel(FuelDrain * Throttle); ParentShip.Push(Direction * Thrust); }
public override void Update(GameTime gameTime) { if (Vector2.Distance(ParentShip.Position, Target.Position + RandomOffset) <= 50) { ParentShip.StopMovement(); Parent.GetState <MinerMiningState>().Target = Target; Parent.SetState <MinerMiningState>(); GameplayState.EffectsManager.AddExplosion(Target.Position + RandomOffset, Color.OrangeRed, 1.0f, 3000); } else { ParentShip.SetDestination(Target.Position + RandomOffset); } }
public void Shoot() { if (delta_time < reload_speed || !Enabled) { return; } if (heat >= 1) { ooo_time = init_ooo_time; return; } for (int i = 0; i < muzzle_positions.Length; i++) { if (!ParentShip.SubstractAmmo(ammo_type, 1)) { return; } // Initialize Bullet Bullet.Spawn( ammo_type, Position + barrels.rotation * muzzle_positions [i], BarrelRot, SceneGlobals.ReferenceSystem.RelativeVelocity(ParentShip.Velocity) + BarrelRot * Vector3.back * muzzle_velocity, ParentShip.Friendly ); // Initialize Hull // --------- // To Come // --------- } if (anim != null) { anim.SetTrigger("fire"); } if (ParentShip.IsPlayer) { Globals.audio.ShootingSound(sound_name); } heat += .2f; delta_time = 0f; }
public override void Update(GameTime gameTime) { if (Vector2.Distance(Target.Position + RandomOffset, ParentShip.Position) <= FollowDistance) { if (Target.IsMoving) { ParentShip.MoveSpeed = Target.MoveSpeed; ParentShip.SetDestination(Target.Position + RandomOffset); } else { ParentShip.StopMovement(); } } else { ParentShip.MoveSpeed = ParentShip.BaseMoveSpeed; ParentShip.SetDestination(Target.Position + RandomOffset); } }
public override void Update(GameTime gameTime) { if (Triggered) { PauseTime += gameTime.ElapsedGameTime.Milliseconds; if (ParentShip.FreezeTime > 0) { Triggered = false; ParentShip.ShakeScreen(50); ParentShip.FreezeTime = 500; } else if (PauseTime > MaxPauseTime && ParentShip.shipAbility.ShipCanShoot()) { Activate(); Triggered = false; } } base.Update(gameTime); }
public override void Trigger() { if (RechargeTime >= MaxRechargeTime) { RechargeTime = 0; WindowMissileBullet b = new WindowMissileBullet(); ParentShip.ParentLevel.AddObject(b); b.SetShipParent(ParentShip); b.SetPosition(ParentShip.getPosition()); b.SetStartingPosition(b.getPosition()); b.SetSpeed(BulletStartSpeed * Logic.ToVector2(Logic.ToAngle(ParentShip.AdjustedAimPointer - ParentShip.getPosition()))); b.SetDamage(BulletDamage, BulletPushTime, BulletVelocityMult); b.SetAttackType(AttackType.Blue); b.SetModifierFactor(1); b.SetLifeTime(BulletLifeTime); b.SetExplosive(ExplosionDistance, ExplosionDamage); } base.Trigger(); }
public override void Update(GameTime gameTime) { if (Vector2.Distance(Target.Position, ParentShip.Position) <= FollowDistance) { if (Target.IsMoving) { ParentShip.MoveSpeed = Target.MoveSpeed; ParentShip.SetDestination(Target.Position); } else { ParentShip.StopMovement(); } Target.RepairArmour(RepairRate * gameTime.DeltaTime()); } else { ParentShip.MoveSpeed = ParentShip.BaseMoveSpeed; ParentShip.SetDestination(Target.Position); } }
public override void Update(GameTime gameTime) { if (ParentShip.GetOffenseProgress() > 0) { ProgressAlpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (ProgressAlpha > 1) { ProgressAlpha = 1; } } else { ProgressAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (ProgressAlpha < 0) { ProgressAlpha = 0; } } if (WaveFSM.PlayerEliminatedState.LastEliminatedTeam != -1) { EliminatedAlpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (EliminatedAlpha > 1) { EliminatedAlpha = 1; } } else { EliminatedAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (EliminatedAlpha < 0) { EliminatedAlpha = 0; } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (Vector2.Distance(Target.Position, ParentShip.Position) <= FollowDistance) { ParentShip.StopMovement(); Waiting = true; } else { if (Waiting) { if (Vector2.Distance(Target.Position, ParentShip.Position) >= FollowDistance * 2) { Waiting = false; } } else { ParentShip.SetDestination(Target.Position); } } }
public override void Update(GameTime gameTime) { ParentShip.SetDestination(Target.Position); foreach (var weapon in ParentShip.Weapons) { if (weapon.TargetType != Target.TargetType) { continue; } if (Vector2.Distance(Target.Position, ParentShip.Position) <= weapon.Range && weapon.CurrentCooldown <= 0) { var angle = MathF.Abs(ParentShip.GetAngleToTarget(Target.Position) - ParentShip.Rotation); if (angle <= weapon.MaxAngle) { GameplayState.ProjectileManager.FireProjectile(weapon, ParentShip, Target, weapon.Damage); weapon.ResetCooldown(); } } } }
public override void Update(GameTime gameTime) { ParentShip.SetDestination(Target.Position); }
public override void Draw(Vector2 Position, Vector2 Size) { Render.DrawSprite(MyTexture, Position, Size, 0, TeamInfo.HudColors[ParentShip.GetTeam()] * Alpha); base.Draw(Position, Size); }
public override void Begin() { ParentShip.SetDestination(Target.Position); }
public override void Begin() { RandomOffset = new Vector2(WorldData.RNG.Next(-50, 50), WorldData.RNG.Next(-50, 50)); ParentShip.SetDestination(Target + RandomOffset); }
public override void Begin() { ParentShip.StopMovement(); }
public override void Update(GameTime gameTime) { ParentShip.SetDestination(Target + RandomOffset); }
public override void PreDraw() { if (OutlineAlpha > 0 || ParentShip.DamageAlpha > 0) { Rectangle SceneViewRectangle = new Rectangle(0, 0, (int)ParentShip.sceneView.Size.X, (int)ParentShip.sceneView.Size.Y); if (OutlineAlpha > 0) { Game1.spriteBatch.Draw(OutlineTexture, SceneViewRectangle, TeamInfo.HudColors[ParentShip.GetTeam()] * OutlineAlpha); } if (ParentShip.DamageAlpha > 0) { Game1.spriteBatch.Draw(DamageTexture, SceneViewRectangle, Color.Red * ParentShip.DamageAlpha); } } }