public void CreateBullet(EnemyDatabase.BulletInfo bulletInfo) { Vector2 pos = tp.position; BulletScript bs = Instantiate(Test.instance.bulletBase, shotPoints[bulletInfo.shotPoint] + pos, Quaternion.identity).GetComponent <BulletScript>(); bs.Init(bulletInfo.angle, bulletInfo.speed, bulletInfo.angleAccel, bulletInfo.speedAccel); }
// Use this for initialization void Start() { this.gameObject.transform.position = new Vector3(0, 5, 120); //start position BulletScript = GameObject.Find("BulletScript"); bulletScript = BulletScript.GetComponent <BulletScript>(); }
void charge() { numShots = 0; if (chargedShot==null) { charge_anim.SetBool("charge", true); chargedShot = Instantiate (gun.bullet, gun.firingLocation.position, Quaternion.identity) as Rigidbody2D; chargedShot.gameObject.SetActive(true); chargedCollider = chargedShot.GetComponent<CircleCollider2D>(); chargedCollider.enabled = false;// disable the collider first script = chargedShot.GetComponent<BulletScript>(); // assign the script if (master.shipMode){ chargedShot.rotation = 90; // 270 degrees means facing north } else { master.setCharge(1f); // set 'charging' layer to activate } chargedShot.GetComponent<SpriteRenderer>().enabled = false; } else { //if (chargeLevel<=totalCharge) Vector3 size = chargedShot.transform.localScale; chargedShot.transform.localScale = new Vector3(size.x*1.5f, size.y*1.5f, 1f); script.damage = script.damage*2; } // make the charged shot stronger chargeLevel++; }
private static IEnumerator Randomizer(Gun gun, BulletScript script) { float num = UnityEngine.Random.Range(.5f, 2.5f); while (!script.homer) { yield return(new WaitForEndOfFrame()); } HomingScript h = script.homer.GetComponent <HomingScript>(); if (!script.Target && !h.main_col) { NetworkMethods.Instance.RpcSetEnabled(script.gameObject, "Renderer", false); NetworkMethods.Instance.RpcSetLayer(script.gameObject, 16); Rigidbody rb = script.GetComponent <Rigidbody>(); Vector3 speed = rb.velocity; rb.velocity = Vector3.zero; float start_time = Time.time; while (start_time + num > Time.time && !h.main_col && !script.Target) { yield return(new WaitForEndOfFrame()); } NetworkMethods.Instance.RpcSetEnabled(script.gameObject, "Renderer", true); NetworkMethods.Instance.RpcSetLayer(script.gameObject, gun.layer); rb.velocity = speed.magnitude * script.transform.forward; } }
public override void Attack() { // Inherits Attack method from Weapon.cs base.Attack(); // Instantiates a bullet and obtains its script. GameObject tempBullet = Instantiate(bullet, bulletSpawnPoint.position, Quaternion.identity); BulletScript bs = tempBullet.GetComponent <BulletScript>(); // The direction of the bullet is towards where you click. Vector3 direction = maincam.ScreenToWorldPoint(Input.mousePosition) - transform.position; direction.z = 0; direction.Normalize(); Instantiate(gunfireAnim, bulletSpawnPoint.position, Quaternion.identity); gunSoundSrc.Play(); // If the script exists... if (bs != null) { // ...bullet aims at mouse position upon click. bs.Setup(direction); } }
public void TryToTriggerGun() { if (shootCounter <= 0) { this.transform.DOShakeRotation(MinimumShootPeriod * 0.8f, 3f); muzzleCounter = muzzleShowPeriod; muzzleFlash.transform.localEulerAngles = new Vector3(0, 0, Random.Range(0, 360)); shootCounter = MinimumShootPeriod; GameObject newBullet = GameObject.Instantiate(bulletCandidate); BulletScript bullet = newBullet.GetComponent <BulletScript>(); bullet.transform.position = muzzleFlash.transform.position; bullet.transform.rotation = muzzleFlash.transform.rotation; if (this.tag == "Player") { gunShootSound.Stop(); gunShootSound.pitch = Random.Range(0.8f, 1); gunShootSound.Play(); bullet.InitAndShoot(muzzleFlash.transform.forward); } else if (this.tag == "soldier") { bullet.InitAndShoot(ep.transform.position - this.transform.position + new Vector3(0, 1.4f, 0)); } //Debug.Log(ep.transform.position - this.transform.position); } }
public static IEnumerator Diverge(Gun gun, BulletScript script) { if (rand.NextDouble() < .1) { Flurry ggun = (Flurry)gun; script.coroutines_running++; while (!script.Target) { yield return(new WaitForEndOfFrame()); } for (float i = 0; i < 360; i += 36) { GameObject bullet = Instantiate(ggun.Bullet, script.transform.position, Quaternion.Euler(0, i, 0)); BulletScript s = bullet.GetComponent <BulletScript>(); Destroy(s.homer); NetworkServer.Spawn(bullet); ggun.Claimed_Gun_Mods -= Diverge; ggun.ReadyWeaponForFire(ref bullet); s.can_pierce = true; ggun.RpcFire(bullet.transform.forward, bullet); ggun.Claimed_Gun_Mods += Diverge; } script.coroutines_running--; } else { yield return(null); } }
//-------------------------------------------------------------------------------------- // OnCollisionEnter: Calls when this object has hit a collision. // // Param: // collision: The object that has been collided with. // // Edited By: // Angus //-------------------------------------------------------------------------------------- private void OnCollisionEnter(Collision collision) { // if the collison is with the player. if (collision.gameObject.tag == "Player") { // set health of the enemy to 0 m_nHealth = 0; m_pPlayerStats.health = -m_nDamage; } // if the collison is with the player. if (collision.gameObject.tag == "Bullet") { Debug.Log("Hit enemy!"); // Get bullet object // GameObject gBullet = GameObject.FindGameObjectWithTag("Bullet"); //Grab bullet information from object. BulletScript bullet = collision.gameObject.GetComponent <BulletScript>(); //take bullet damage away from health. m_nHealth = -bullet.bulletDamage; if (m_nHealth < 0) { //Add 10 points to score. m_pPlayerStats.score += 10; } } }
private void Start() { if (BulletScript == null) { BulletScript = GetComponent <BulletScript>(); } }
void FireBullet() { GameObject newBullet = Instantiate(bullet, transform.position, transform.rotation) as GameObject; BulletScript newBulletScript = newBullet.GetComponent <BulletScript> (); newBulletScript.damage = castDamage; int direction = 1; if (!flipped) { Vector3 theScale = newBullet.transform.localScale; theScale.x *= -1; newBullet.transform.localScale = theScale; direction = -1; } newBullet.GetComponent <Rigidbody2D> ().AddRelativeForce(new Vector2(direction * castAngle.x, castAngle.y), ForceMode2D.Impulse); //Test different sizes newBullet.transform.localScale *= 1.5f; if (!textureMissing) { if (newBullet.GetComponent <SpriteRenderer>().sprite != null) { newBullet.GetComponent <SpriteRenderer>().sprite = Sprite.Create(particleTexture, new Rect(0, 0, particleTexture.width, particleTexture.height), new Vector2(0.5f, 0.5f)); } else { Debug.LogError("Cannot locate SpriteRenderer"); } } }
void OnTriggerEnter2D(Collider2D collider) { BulletScript bullet = collider.gameObject.GetComponent <BulletScript> (); healthslider.value = currenthealth; if (bullet) { currenthealth -= 2; health -= bullet.getdamage(); //health -= 30; bullet.hit(); Handheld.Vibrate(); healthslider.value = currenthealth; if (currenthealth <= 0) { GetComponent <Animator> ().SetBool("deadBool", true); GetComponent <Animator> ().SetTrigger("deadTrigger"); DestroyObject(gameObject, 3.0f); DestroyObject(gun, 0.2f); StartCoroutine(DefeatScreen()); } } }
private static IEnumerator Bounce(Gun gun, BulletScript script) { script.coroutines_running++; script.can_bounce = true; script.lasting_time *= 4; script.coroutines_running--; yield return(new WaitForFixedUpdate()); Vector3 original_velocity = script.rb.velocity; while (script) { while (!script.damaging) { yield return(new WaitForEndOfFrame()); } script.rb.velocity = new Vector3(script.rb.velocity.x, 0, script.rb.velocity.z); if (script.rb.velocity.magnitude < original_velocity.magnitude) { script.rb.velocity = script.rb.velocity.normalized * original_velocity.magnitude; } yield return(new WaitForFixedUpdate()); } }
public void Fire() { if (canFire) { if (Time.time > nextFireTime) { nextFireTime = Time.time + fireRate; if (bulletsPerMagazine > 0) { GameObject bulletObject = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); //bulletObject.GetComponent<Rigidbody>().velocity = speed * firePoint.forward; BulletScript bullet = bulletObject.GetComponent <BulletScript>(); //Set bullet damage according to weapon damage value bullet.SetDamage(weaponDamage); bulletsPerMagazine--; audioSource.clip = fireAudio; audioSource.Play(); } else { StartCoroutine(Reload()); } } } }
private static IEnumerator Tremor(Gun gun, BulletScript script) { script.coroutines_running++; while (!script.has_collided && !script.Target)//Wait for collision and check target validity { yield return(new WaitForEndOfFrame()); } string layer = ""; if (gun.client_user) { layer = LayerMask.LayerToName( gun.client_user.gameObject.layer); } else { layer = LayerMask.LayerToName( gun.GetComponentInParent <HealthDefence>() .gameObject.layer); } Collider[] target_colliders = Physics.OverlapSphere(script.gameObject.transform.position, 7, LayerMask.GetMask(layer), QueryTriggerInteraction.Collide); foreach (Collider col in target_colliders) { UnitHealthDefence HP = col.GetComponent <UnitHealthDefence>(); if (HP && script.Target.netId != HP.netId) { HP.DetermineStun(1); } } script.coroutines_running--; }
private static IEnumerator Quake(Gun gun, BulletScript script) { script.coroutines_running++; while (!script.has_collided && !script.Target)//Wait for collision and check target validity { yield return(new WaitForEndOfFrame()); } string layer = ""; if (gun.client_user) { layer = LayerMask.LayerToName( gun.client_user.gameObject.layer); } else { layer = LayerMask.LayerToName( gun.GetComponentInParent <HealthDefence>() .gameObject.layer); } Collider[] target_colliders = Physics.OverlapSphere(script.gameObject.transform.position, 7, LayerMask.GetMask(layer), QueryTriggerInteraction.Collide); foreach (Collider col in target_colliders) { HealthDefence HP = col.GetComponent <HealthDefence>(); if (HP && script.Target.netId != HP.netId) { int d = rand.Next(script.lower_bound_damage, script.upper_bound_damage) / 2; HP.RpcDisplayHPChange(Color.red, d); HP.HP -= d; } } script.coroutines_running--; }
private static IEnumerator Sunder(Gun gun, BulletScript script) { script.coroutines_running++; script.sunder_strength += .10; script.coroutines_running--; yield return(null); }
/// <summary> /// 发射子弹的防御塔在发射时调用 /// </summary> /// <param name="es"></param> /// <returns></returns> public virtual TurretAttack Shoot(EnemyScript es) { GameObject attack = Instantiate(attackPrefab); if (type == BULLET) { attack.transform.position = this.transform.position; BulletScript bs = attack.GetComponent <BulletScript>(); bs.SetBullet(this); bs.flying = true; return(bs); } else if (type == EXPLOSION) { attack.transform.position = target.transform.position; ExplosionScript explode = attack.GetComponent <ExplosionScript>(); explode.SetExplosion(this); explode.Explode(); } else if (type == LASER) { LaserScript ls = attack.GetComponent <LaserScript>(); ls.SetLaser(this); ls.Emit(); } return(null); }
private void OnTriggerEnter(Collider other) { LaserBulletScript laserBullet = other.gameObject.GetComponent <LaserBulletScript>(); ShotgunBulletScript shotgunBullet = other.gameObject.GetComponent <ShotgunBulletScript>(); BulletScript normalBullet = other.gameObject.GetComponent <BulletScript>(); Vector3 collisionPoint = other.ClosestPoint(transform.position); Vector3 collisionNormal = transform.InverseTransformDirection(collisionPoint - transform.position).normalized; gameManager.BeginEffect(GameConstants.EffectTypes.BulletHit, collisionPoint, collisionNormal).transform.SetParent(transform); if (laserBullet != null && !laserBullet.isEnemyShot) { HitByBullet(laserBullet.damage); laserBullet.OnHit(); } else if (shotgunBullet != null && !shotgunBullet.isEnemyShot) { HitByBullet(shotgunBullet.damage); shotgunBullet.OnHit(); } else if (normalBullet != null && !normalBullet.isEnemyShot) { HitByBullet(normalBullet.damage); normalBullet.OnHit(); } }
private void weaponShot(Vector2 lookDir) { Vector3 newPos = transform.position; Vector2 lookDirNorm = lookDir.normalized; newPos.x += lookDirNorm.x * 0.5f; newPos.y += lookDirNorm.y * 0.5f; GameObject newBullet; float angle = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg; newBullet = GameObject.Instantiate(bullet, newPos, Quaternion.AngleAxis(angle, Vector3.forward)); newBullet.GetComponent <SpriteRenderer> ().sprite = weaponInventory.bulletSprite; BulletScript bs = newBullet.GetComponent <BulletScript> (); bs.dir = lookDir.normalized; bs.speed = weaponInventory.bulletSpeed; bs.origin = gameObject; bs.setLifeTime(weaponInventory.bulletLifeTime); bs.type = weaponInventory.bulletType; // Sound SoundAlerter.instance.CreateSoundAt(transform.position, weaponInventory.shotSoundRange); GameObject newBulletSound = GameObject.Instantiate(weaponSound, transform.position, transform.rotation); AudioSource audio = newBulletSound.GetComponent <AudioSource>(); audio.clip = weaponInventory.weaponShotSound; audio.volume = PlayerPrefs.GetFloat("soundsVolume"); audio.Play(); Destroy(newBulletSound, 1.0f); }
public void OnTriggerEnter(Collider collider) { RocketMan player = collider.gameObject.GetComponent <RocketMan> (); if (player != null) { if (isActive) { if (!player.shield) { player.Die(); //end game GameEngine.EndGame(); } } } BulletScript bullet = collider.gameObject.GetComponent <BulletScript> (); if (bullet != null) { SetInactive(); } }
//-------------------------------- // 3 - Shooting from another script //-------------------------------- /// <summary> /// Create a new projectile if possible /// </summary> public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property BulletScript shot = shotTransform.gameObject.GetComponent <BulletScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.up; // towards in 2D space is the right of the sprite } } }
public void TryToTriggerGun() { if (shootCounter <= 0) { Debug.Log("Hi"); /* * gunShootSound.Stop (); * gunShootSound.pitch = Random.Range (0.8f, 1); * gunShootSound.Play (); */ this.transform.DOShakeRotation(MinimumShootPeriod * 0.8f, 3f); muzzleCounter = muzzleShowPeriod; muzzleFlash.transform.localEulerAngles = new Vector3(0, -6, Random.Range(0, 360)); shootCounter = MinimumShootPeriod; GameObject newBullet = GameObject.Instantiate(bulletCandidate); BulletScript bullet = newBullet.GetComponent <BulletScript> (); bullet.transform.position = muzzleFlash.transform.position; bullet.transform.rotation = muzzleFlash.transform.rotation; bullet.InitAndShoot(muzzleFlash.transform.forward); AttackSensor.CollisionObjects [0].transform.GetChild(0).GetChild(0).SendMessage("Hit", 1); Debug.Log("bye"); } }
void FirePrimary() { bool canfire = ((energyController.CurrentEnergy > PrimaryEnergyConsumption) && _canFirePrimary); if (canfire) { GameObject bullet = (GameObject)GameObject.Instantiate(PrimaryAmmo, transform.position + transform.forward * 3, Quaternion.identity); BulletScript bController = (BulletScript)bullet.GetComponent <BulletScript>(); var shootPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, shootDistance); shootPosition = Camera.main.ScreenToWorldPoint(shootPosition); // GameObject player = GameObject.FindGameObjectWithTag("Player"); bullet.transform.LookAt(shootPosition); bController.fire(); if (!_audioSource.isPlaying) { _audioSource.Play(); } energyController.decreaseEnergy(PrimaryEnergyConsumption); //rBullet.AddForce(firingSpeed * player.transform.forward); _canFirePrimary = false; } }
public override bool Action() { if ((Time.time - timeOfLastShot) < (1 / fireRate)) { return(false); } timeOfLastShot = Time.time; GameObject projectile = Instantiate(projectilePrefab); BulletScript bs = projectile.GetComponent <BulletScript>(); if (bs != null) { bs.damage = bulletDamage; } projectile.transform.position = projectileSpawnPoint.position; projectile.transform.rotation = projectileSpawnPoint.rotation; Vector3 forward_vector = projectile.transform.rotation * Vector3.forward; forward_vector.y = 0; Vector3 velocity = forward_vector.normalized * bulletSpeed; Rigidbody projRb = projectile.GetComponent <Rigidbody>(); projRb.velocity = velocity; if (gunshot != null) { AudioManager.Instance.PlayClipAtPoint(gunshot, projectileSpawnPoint.position, volume: 0.15f); } // end of Action() return(true); }
// Use this for initialization void Start() { gun = GameObject.Find ("Gun"); stick = GameObject.Find ("Stick"); bullet = GameObject.Find ("Bullet"); bs = bullet.GetComponent<BulletScript> (); }
private static IEnumerator Boomerang(Gun gun, BulletScript script) { Vector3 start_pos = script.transform.position; yield return(new WaitForFixedUpdate()); if (script.rb) { script.coroutines_running++; float speed = script.rb.velocity.magnitude; while (!script.Target) { yield return(new WaitForEndOfFrame()); } script.rb.velocity = Vector3.zero; script.coroutines_running--; if (!script.can_pierce) { script.can_pierce = true; script.coroutines_running--; script.transform.LookAt(start_pos); script.rb.velocity = speed * script.transform.forward; yield return(new WaitForFixedUpdate()); script.can_pierce = false; } else { script.transform.LookAt(start_pos); script.rb.velocity = speed * script.transform.forward; script.coroutines_running--; } } }
private void Fight() { float dist = GTTools.GetHorizontalDistance(Owner.Pos, Owner.GetTarget().Pos); if (dist > AI.ATKDIST) { AI.ChangeAIState(EAIState.AI_CHASE); return; } if (Owner.FSM == FSMState.FSM_SKILL) { return; } Owner.SendStateMessage(FSMState.FSM_Attack); Timerr += Time.deltaTime; if (Timerr >= SkillCD) { GameObject Bullet = ZTPool.Instance.GetGo("Model/Weapons/bullet"); BulletScript bulletScript = Bullet.GET <BulletScript>(); AudioClip clip = LoadResource.Instance.Load <AudioClip>("Sounds/AK47A"); ZTAudio.Instance.PlaySound(clip); bulletScript.damage = Owner.GetAttr(EAttr.Atk); bulletScript.AttackActor = this.Owner; if (Owner.mActorPart.AttackTransform != null) { Bullet.transform.position = Owner.mActorPart.AttackTransform.position; Bullet.transform.eulerAngles = Owner.mActorPart.AttackTransform.eulerAngles; } Timerr = 0; } }
private static IEnumerator Arrows(Gun gun, BulletScript script) { script.coroutines_running++; Quaternion rot = Quaternion.LookRotation( gun.barrel_end.forward ) * Quaternion.Euler(0, 90, 0); Flurry Gun = (Flurry)gun; GameObject b = Instantiate(Gun.Bullet, gun.barrel_end.position, rot) as GameObject; NetworkServer.Spawn(b); Gun.Claimed_Gun_Mods -= Arrows; Gun.ReadyWeaponForFire(ref b); Gun.RpcFire(b.transform.forward, b); rot = Quaternion.LookRotation( gun.barrel_end.forward ) * Quaternion.Euler(0, -90, 0); b = Instantiate(Gun.Bullet, gun.barrel_end.position, rot) as GameObject; NetworkServer.Spawn(b); Gun.ReadyWeaponForFire(ref b); Gun.RpcFire(b.transform.forward, b); while (!script.Target && !Gun.HasReloaded(-.2f)) { yield return(new WaitForFixedUpdate()); } Gun.Claimed_Gun_Mods += Arrows; script.coroutines_running--; }
void OnTriggerEnter2D(Collider2D col) { //Bullet Collision if (col.gameObject.tag == "EnemyBullet" && invincible == false) { BulletScript bulletScript = col.GetComponent <BulletScript>(); health -= bulletScript.bulletDamage; bulletScript.passThrough--; GetComponent <SpriteRenderer>().color = Color.red; hit = 100; invincible = true; } if (col.gameObject.tag == "Hazard" && invincible == false) { explosionScript explosion = col.GetComponent <explosionScript>(); health -= explosion.damage; GetComponent <SpriteRenderer>().color = Color.red; hit = 100; invincible = true; } }
void Update() { Physics2D.IgnoreLayerCollision(8, 11); Physics2D.IgnoreLayerCollision(11, 12); if (Player == null) { findPlayer(); } timer--; if (playerRange() && playerSeen()) { Debug.Log("Player Targeted"); if (timer <= 0) { bullets.Add(Instantiate(bulletPrefab, new Vector3(transform.position.x, transform.position.y, 0f), Quaternion.Euler(0, 0, 0)) as GameObject); BulletScript bscript = bullets [currentBullet].GetComponent <BulletScript> (); //Fetch bullet script bscript.setPlayer(Player); // currentBullet++; //Add bullets to list timer = 40; } } else { } }
void FireWeapon() { // Play sound effect audioSource.PlayOneShot(sfxTrumpetFire, 0.5f); // Spawn all the bullets we need and store them into a array //List<GameObject> bullets = new List<GameObject>(player.bulletAmount); GameObject[] bullets = new GameObject[bulletAmount]; for (int i = 0; i < bullets.Length; i++) { Vector3 origin = new Vector3(bulletSpawnPoint.transform.position.x, bulletSpawnPoint.transform.position.y - 3, bulletSpawnPoint.transform.position.z); GameObject bullet = GameObject.Instantiate(bulletPrefab, origin, Quaternion.identity); //bullets.Add(bullet); bullets[i] = bullet; bullet.SetActive(true); // Rotate the bullets to face a new direction based on the spread // Also be sure to set the speed and attack power of the bullets BulletScript bulletScript = bullet.GetComponent <BulletScript>(); bulletScript.attackPower = bulletAttackPower; bulletScript.speed = bulletSpeed; float playerAngle = Vector3.SignedAngle(transform.forward, Vector3.forward, Vector3.up); bullet.transform.rotation = Quaternion.AngleAxis(-playerAngle + (-spread / 2 + (i * (spread / bullets.Length))), Vector3.up); // Reset the timer } }
private static IEnumerator Hunter(Gun gun, BulletScript script) { script.coroutines_running++; while (!script.homer)//wait for homingscript reference { yield return(new WaitForEndOfFrame()); } HomingScript home = script.homer.GetComponent <HomingScript>(); while (!home.homing && !script.has_collided)//Wait untuil it homes or collides { yield return(new WaitForEndOfFrame()); } Collider[] bullet_colliders = Physics.OverlapSphere(script.gameObject.transform.position, 10, LayerMask.GetMask("Default"), QueryTriggerInteraction.Collide); foreach (Collider col in bullet_colliders) { /*Check if its a flurry bullet that isn't isn't homing*/ BulletScript b = col.GetComponent <BulletScript>(); if (b && b.gameObject.layer == script.gameObject.layer && b.gun_reference is Flurry && !b.homer.GetComponent <HomingScript>().homing && home.main_col) { /*Make bullet face target and fire towards them*/ b.transform.LookAt(new Vector3(home.main_col.gameObject.transform.position.x, script.transform.position.y, home.main_col.gameObject.transform.position.z)); b.GetComponent <Rigidbody>().velocity = b.transform.forward * b.GetComponent <Rigidbody>().velocity.magnitude; } } script.coroutines_running--; }
void UpdateHistory(byte shotID,BulletScript bulletScript){ ShotInfo shot; shot.shotID = shotID; shot.startPosition = bulletScript.transform.position; shot.startDirection = bulletScript.transform.forward; _shotInfoHistory.Add(shot); if(_shotInfoHistory.Count > _maxShotHistory){ _shotInfoHistory.RemoveAt(0); } }
public void PlayerHit(BulletScript shot) { var explosion = Instantiate (shot.Explosion) as Transform; explosion.position = shot.transform.position; Destroy (explosion.gameObject, 2); Health -= 1; if (Health <= 0) { GameOver (); } Destroy (shot.gameObject); }
public void Shoot(bool isOwner,byte shotID,BulletScript bullet ){ ShootPoint.SendMessage ("Play", SendMessageOptions.DontRequireReceiver); bullet.Shoot (_weaponController, isOwner,shotID); }
// Use this for initialization void Start() { bulletScript = GameObject.Find("Bullet").GetComponent<BulletScript>(); Debug.Log(bulletScript); }