// -------------------------------------------------------------------------- /// <summary> /// BASHER SIDE MISSILES ATTACK /// </summary> // -------------------------------------------------------------------------- void BasherSideMissilesAttack(bool leftSide) { animator.SetBool(ToggleOpen, true); animator.SetBool(ToggleLeftSide, leftSide); animator.SetTrigger(Attack_sideMissiles); audioSource.PlayOneShot(AttackDoorsOpen); List <GameObject> inheritFromList = new List <GameObject>(); if (leftSide) { inheritFromList = new List <GameObject>(MissileSpawnPoints_L); } else { inheritFromList = new List <GameObject>(MissileSpawnPoints_R); } preLaunchSideMissiles.Clear(); foreach (GameObject currentSpawnPoint in inheritFromList) { GenericProjectileFire(BasherMissile, currentSpawnPoint, ShotDirection.Right); CurrentProjectile.GetComponent <StarProjectileAnim>().DelayFiring = true; preLaunchSideMissiles.Add(CurrentProjectile); CurrentProjectile.transform.parent = currentSpawnPoint.transform; } StartCoroutine(BasherSideMissilesIncrementallyFire(leftSide)); }
public void Draw(SpriteBatch spriteBatch, float DeltaTime) { #region Camera CameraPosition.X = 0; CameraPosition.Y = 0; int Sum = 0; foreach (var Player in PlayerManager.Players) { if (Player.Value.Type == WormsDeathmatch.Player.PlayerType.Local) { CameraPosition += Player.Value.ControlledWorm.Position; Sum++; } } CameraPosition /= Sum; CameraPosition.X -= spriteBatch.GraphicsDevice.Viewport.Width / 2; CameraPosition.Y -= spriteBatch.GraphicsDevice.Viewport.Height / 2; if (CameraPosition.X < 0) { CameraPosition.X = 0; } if (CameraPosition.Y < 0) { CameraPosition.Y = 0; } if (CameraPosition.X + spriteBatch.GraphicsDevice.Viewport.Width > Ground.Width) { CameraPosition.X = Ground.Width - spriteBatch.GraphicsDevice.Viewport.Width; } if (CameraPosition.Y + spriteBatch.GraphicsDevice.Viewport.Height > Ground.Height) { CameraPosition.Y = Ground.Height - spriteBatch.GraphicsDevice.Viewport.Height; } #endregion spriteBatch.Draw(ResourceManager.Skybox, new Rectangle(0, 0, ResourceManager.Skybox.Width, ResourceManager.Skybox.Height), Color.White); spriteBatch.Draw(Ground, new Rectangle(-(int)CameraPosition.X, -(int)CameraPosition.Y, Ground.Width, Ground.Height), Color.White); foreach (var CurrentProjectile in Projectiles) { CurrentProjectile.Draw(spriteBatch, DeltaTime); } foreach (var CurrentWorm in Worms) { } PlayerManager.Draw(spriteBatch, DeltaTime); foreach (var CurrentTextTag in TextTags) { CurrentTextTag.Draw(spriteBatch, DeltaTime); } foreach (var TextTagToRemove in TextTagsToRemove) { TextTags.Remove(TextTagToRemove); } TextTagsToRemove.Clear(); }
public void Update(GameTime gameTime) { CurrentProjectile.Update(gameTime); Timer--; if (Direction == Direction.Right) { if (hitSlowdown > 0) { X += XSpeed / 5; } else { X += XSpeed; } } else { X -= XSpeed; } Y += YSpeed; Hitbox = new Rectangle(); Hitbox info = CurrentProjectile.CurrentHitboxInfo; if (info != null) { Hitbox = info.getHitboxRectangle(Hitbox, Direction.Right, v2Position, CurrentProjectile.FrameWidth); } if (hitSlowdown > 0) { hitSlowdown--; } if (PlayOnce) { Finished = CurrentProjectile.IsDone; } else { if (Timer <= 0) { Finished = true; } if (CurrentProjectile.PlayCount > 0) { // If there is, see if the currently playing animation has // completed a full animation loop // if (!String.IsNullOrEmpty(CurrentProjectile.NextAnimation)) { // If it has, set up the next animation CurrentAnimation = CurrentProjectile.NextAnimation; } } } }
public void Update(float DeltaTime) { CurrentKeyboard = Keyboard.GetState(); PlayerManager.Update(DeltaTime); foreach (var CurrentWorm in Worms) { CurrentWorm.Update(DeltaTime); } foreach (var CurrentProjectile in Projectiles) { CurrentProjectile.Update(DeltaTime); } foreach (var ProjectileToRemove in ProjectilesToRemove) { Projectiles.Remove(ProjectileToRemove); } ProjectilesToRemove.Clear(); }
IEnumerator BasherHatchLaunchBullet() { yield return(new WaitForSeconds(BasherLaunchBulletDelay)); while (starGameManagerRef.GamePaused) { yield return(null); } // shotdirection is irrelevant audioSource.PlayOneShot(AttackHatchMissile); GenericProjectileFire(BasherHatchBullet, BulletSpawnPoint, ShotDirection.Right); Transform cachedParent = CurrentProjectile.transform.parent.transform; CurrentProjectile.transform.parent = BulletSpawnPoint.transform.parent; // delete this? CurrentProjectile.transform.parent = cachedParent; // why are there two? string hatchBulletLength = "short"; int randomHatchBulletLength = Random.Range(0, 3); switch (randomHatchBulletLength) { case 1: hatchBulletLength = "long"; break; case 2: hatchBulletLength = "straight"; break; default: break; } CurrentProjectile.GetComponentInChildren <Animator>().SetTrigger(hatchBulletLength); StartCoroutine(BasherHatchReplace()); }