void shoot() { BounceBullet bullet = GlobalController.instance.getCurPool().Spawn(GlobalController.instance.prefabSetting.bounceBullet).GetComponent <BounceBullet>(); bullet.init(tf.position + topOffset, gScale, initVelocity, bulletData, tf.position.y + bottomOffset ); }
void Start() { shake = Camera.main.GetComponent <ScreenShake>(); parentBul = transform.parent.GetComponent <BounceBullet>(); freezeDuration = startFreezeDuration; Invoke("ObjectShake", 4f); if (SceneManager.GetActiveScene().name == "tri.Attack") { scoreText = GameObject.Find("ScoreText").GetComponent <ScoreText>(); comboUI = FindObjectOfType <ComboUI>(); } }
public void Shoot(Vector3 _aimDirection) { if (!enable || !canShot) { return; } BounceBullet bullet = Instantiate(bulletPrefab, shootPosition.position, Quaternion.LookRotation(_aimDirection, Vector3.up)); bullet.Setup(tankCtrl, shootSpeed, maxBounce); firingRateRoutine = FiringRateCoroutine(); StartCoroutine(firingRateRoutine); }
public static Projectile CreateProjectile(Dictionary <string, object> projectileProperties) { Projectile projectile = null; string textureName = (string)projectileProperties["textureName"]; Texture2D texture = TextureFactory.GetTexture(textureName); string colorName = (string)projectileProperties["color"]; Color color = System.Drawing.Color.FromName(colorName).ToXNA(); MovementPattern movement = MovementPatternFactory.CreateMovementPattern((Dictionary <string, object>)projectileProperties["movementPattern"]); int damage = Convert.ToInt32((float)projectileProperties["damage"]); switch (projectileProperties["projectileType"]) { case "bullet": projectile = new Bullet(texture, color, movement, damage); break; case "bouncingBullet": projectile = new BouncingBullet(texture, color, movement, damage); break; case "bounceBullet": int numberOfTimesToBounce = (int)projectileProperties["bounceTimes"]; projectile = new BounceBullet(texture, color, movement, damage, numberOfTimesToBounce); break; case "pushBullet": projectile = new PushBullet(texture, color, movement, damage); break; default: throw new Exception("Invalid Projectile Type"); } return(projectile); }
public override void FireBullet(Vector3 firePos, Vector3 fireDirection) { if (canFire() == false) { return; } FireDelayOn(); PlayFireAnim(); useBullet(); SoundManager.Instance.PlaySoundEffect("tenisfire"); BounceBullet bounceBullet = ObjectManager.Instance.bounceBulletPool.GetItem(); if (bounceBullet != null) { bounceBullet.Initialize(BulletType.PlayerBullet, firePos + fireDirection.normalized * 0.1f, fireDirection, 10f, 5, BounceBulletType.tenisBall, damage); } }
public override void FireBullet(Vector3 firePos, Vector3 fireDirection) { if (canFire() == false) { return; } FireDelayOn(); PlayFireAnim(); useBullet(); SoundManager.Instance.PlaySoundEffect("cuegunfire"); for (int i = 0; i < 5; i++) { Vector3 fd = Quaternion.Euler(0f, 0f, -20f + i * 10f) * fireDirection; BounceBullet bounceBullet = ObjectManager.Instance.bounceBulletPool.GetItem(); if (bounceBullet != null) { bounceBullet.Initialize(BulletType.PlayerBullet, firePos + fd.normalized * 0.1f, fd.normalized, 10f, 3, BounceBulletType.BillardsBall); } } }
void DeleteObjectsOnPlayerDamage(bool playerIsDead) { EnemySpawner.spawner.SetIsSpawning(false); if (playerIsDead) { AudioManager.Instance.Stop("MusicGame"); // Achievement checks TripleCheckUnlock(); FollowCheckUnlock(scoreText.GetScore()); RapidCheckUnlock(); healthUI.DisableUI(); deathText.EnableText(); scoreText.MoveText(); scoreText.SetHighScore(); ReadWriteSaveManager.Instance.SetData("PlayedOnce", true, true); } GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy"); foreach (GameObject enemy in enemies) { if (enemy != null) { Destroy(enemy); } } GameObject[] bullets = GameObject.FindGameObjectsWithTag("Bullet"); foreach (GameObject bullet in bullets) { if (bullet != null) { Destroy(bullet); } } SpawningObject[] spawningObjects = FindObjectsOfType <SpawningObject>(); foreach (SpawningObject spawningObj in spawningObjects) { if (spawningObj != null) { Destroy(spawningObj.gameObject); } } Bullet triBullet = FindObjectOfType <Bullet>(); if (triBullet != null) { Destroy(triBullet.gameObject); } TripleBullet tripleBullet = FindObjectOfType <TripleBullet>(); if (tripleBullet != null) { Destroy(tripleBullet.gameObject); } FollowBullet followBullet = FindObjectOfType <FollowBullet>(); if (followBullet != null) { Destroy(followBullet.gameObject); } SpongeBullet spongeBullet = FindObjectOfType <SpongeBullet>(); if (spongeBullet != null) { Destroy(spongeBullet.gameObject); } RapidBullet rapidBullet = FindObjectOfType <RapidBullet>(); if (rapidBullet != null) { Destroy(rapidBullet.gameObject); } BounceBullet bounceBullet = FindObjectOfType <BounceBullet>(); if (bounceBullet != null) { Destroy(bounceBullet.gameObject); } }