private void Shoot() { Vector2 firePosition = new Vector2(transform.position.x + fireOffset.x, transform.position.y + fireOffset.y); MuzzleFlash flash = ((GameObject)Instantiate(muzzleFlashPrefab, firePosition, Quaternion.identity)).GetComponent <MuzzleFlash>(); BackgroundManager.instance.PlaySound(10); }
void Start() { onFire += ShootBullet; onFire += () => { StartCoroutine(Reload()); }; MuzzleFlash flash = this.GetComponentInChildren <MuzzleFlash>(); if (flash) { onFire += flash.Flash; } Animator anim = this.GetComponent <Animator>(); if (anim) { onFire += () => { anim.SetTrigger("Fire"); } } ; CameraRumble rumble = FindObjectOfType <CameraRumble>(); if (rumble) { onFire += rumble.Rumble; } GameManager gameManager = FindObjectOfType <GameManager>(); if (gameManager) { onFire += gameManager.AddPoint; } }
public override void Start() { base.Start(); muzzleFlash = GetComponent <MuzzleFlash>(); //PoolManager.instance.CreatePool(projectile.gameObject, 30); PoolManager.instance.CreatePool(shell.gameObject, 30); }
void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); msSinceLastFired = msBetweenShots; triggerReleasedSinceLastShot = true; Ammo = magazineSize; }
private void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); shotsRemainingBurst = burstCount; remainingProjectiles = projectilesPerMag; }
public override void Init(UnitControl _owner) { base.Init(_owner); type = WeaponType.Ranged; projectilePrefab = gameManager.GetPrefab("Projectile"); muzzle = transform.Find("Muzzle"); GameObject muzzleFlashObj = Instantiate(gameManager.GetPrefab("MuzzleFlash"), muzzle); muzzleFlash = muzzleFlashObj.GetComponent <MuzzleFlash>(); magazine = transform.Find("Magazine"); rounds = magazineSize; if (_owner.IsPlayer) { if (hasScope) { GameObject scopeCamObj = Instantiate(gameManager.GetPrefab("ScopeCam"), muzzle); scope = scopeCamObj.AddComponent <ScopeControl>(); scopeCamObj.transform.localRotation = Quaternion.identity; } if (needsUI) { GameObject weaponUIObj = Instantiate(gameManager.GetPrefab("WeaponUI")); weaponUI = weaponUIObj.GetComponent <WeaponUI>(); weaponUI.Init(this); } } }
void Start() { shotsRemainingInBurst = burstCount; cam = GameObject.FindObjectOfType <FreeLookCam>(); muzzleflash = GetComponent <MuzzleFlash>(); audioSource = GetComponent <AudioSource>(); }
void Start() { muzzleflash = GetComponent <MuzzleFlash> (); shotsRemainingInBurst = burstCount; projectilesRemainingInMag = projectilesPerMag; startEulerAngles = transform.localEulerAngles; }
void Start() { muzzleflash = GetComponent <MuzzleFlash> (); shotsRemainingInBurst = burstCount; projectilesRemainingInMag = projectilesPerMag; startPosition = transform.position; }
void Start() { rmData = GetComponent <RadarManager>(); rocketHUD = GameObject.Find("fake weapon hud").GetComponent <Image>();; rocketHUD.gameObject.SetActive(true); SpeedReadout = GameObject.Find("Speed"); throttleReadout = GameObject.Find("Throttle"); if (optionalDangerHeightReadout) { dangerBaseText = optionalDangerHeightReadout.text; } mFlash = GetComponent <MuzzleFlash>(); mFlash.Reset(); StartCoroutine(rocketSalvoRelease()); shootableScript = GetComponent <Shootable>(); wasHealth = startHealth = shootableScript.healthLimit; UI_ThrottleReadout = throttleReadout.GetComponent <UI_Speed> (); UI_SpeedReadout = SpeedReadout.GetComponent <UI_Speed> (); hardpointRef = missionTarget.GetComponentInChildren <HardPointCounter>(); hardpointMax = hardpointRef.hardpointCount; }
public void Shoot() { MuzzleFlash.Play(); foreach (GameObject spawnpoint in Spawnpoints) { if (Physics.Raycast(spawnpoint.transform.position, spawnpoint.transform.forward, out RaycastHit hit)) { //hit effects if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * ImpactForce); } GameObject impactFX = Instantiate(UsedImpactPrefab, hit.point, Quaternion.LookRotation(hit.normal, transform.up)); impactFX.transform.SetParent(hit.collider.transform); //hitting an enemy turret if (hit.transform.CompareTag("EnemyTurret")) { //instantiate a metal impact prefab DeployableHealth hitHealth = hit.transform.GetComponent <DeployableHealth>(); hitHealth.Health -= 3f; } } } ShotBeamAmmoControl.CurrentAmmo--; NextFire = Time.time + Delay; }
void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); projectilesRemaining = projectilesPerMag; PoolManager.instance.CreatePool(projectile.gameObject, 30); PoolManager.instance.CreatePool(shell.gameObject, 30); }
/// <summary> /// Fires the one shot. /// </summary> /// <param name="_target">Target.</param> public void FireOneShot(Transform _target) { if (Ammunition.Enabled) { Ammunition.Fire(_target); } if (Recoil.Enabled) { Recoil.Start(); } if (LaunchSound.Enabled) { LaunchSound.Play(); } if (MuzzleFlash.Enabled) { MuzzleFlash.Start(); } if (Shell.Enabled) { Shell.Start(); } if (Effect.Enabled) { Effect.Start(OwnerComponent); } }
void Start() { playerCamera = GameObject.FindGameObjectWithTag("PlayerCamera").GetComponent <Camera>(); if (playerCamera == null) { Debug.LogError("Camera with tag player camera not found"); } muzzleFlash = GetComponent <MuzzleFlash>(); // init all classes effects.Init(transform); // Calculate the actual ROF to be used in the weapon systems. The rateOfFire variable is // designed to make it easier on the user - it represents the number of rounds to be fired // per second. Here, an actual ROF decimal value is calculated that can be used with timers. // e.g if rateOfFire = 0.5 then num bullets shot per second = (1.0 / 0.5) = 2 bullets per second. if (rateOfFire != 0) { actualROF = 1.0f / rateOfFire; } else { actualROF = 0.01f; } // Make sure the fire timer starts at 0 fireTimer = 0.0f; }
void Start() { muzzleflash = GetComponent <MuzzleFlash> (); burstShotsRemaining = burstCount; bulletsRemainingInMag = magSize; reloading = false; }
public void ShootAnimEnded() { CancelInvoke(); if (MuzzleFlash != null) { MuzzleFlash.SetActive(false); } }
private void muzzleFlashStuff() { if (MuzzleFlash != null) { MuzzleFlash.transform.Rotate(new Vector3(0, 0, UnityEngine.Random.Range(0.0f, 360.0f))); MuzzleFlash.SetActive(!MuzzleFlash.activeSelf); } }
void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); shotsRemainingInBurst = burstCount; triggerReleasedSinceLastShot = true; projectilesRemainingInMag = projectilesPerMag; listenerPos = AudioManager.instance.transform.position; }
void Start() { startingPos = transform.localPosition; muzzleFlash = GetComponent <MuzzleFlash>(); shotsRemainingInBurst = burstCount; remainingBulletsInMag = bulletsPerMag; reloading = false; }
// Use this for initialization void Start() { muzzleflash = GetComponent <MuzzleFlash> (); shotsRemainingInBurst = burstCount; projectilesRemainingInMag = projectileperMag; }
private void muzzleFlashStuff() { CancelInvoke(); if (MuzzleFlash != null) { MuzzleFlash.SetActive(false); } }
private void Start() { m_MuzzleFlash = GetComponent <MuzzleFlash> (); m_ShotsRemainingInBurst = m_BurstCount; m_AmmunitionsRemainingInMagazine = m_AmmunitionsPerMagazine; m_ViewCamera = Camera.main; }
//为子类提供重写Start方法的机会 protected virtual void Start() { ammoUi = GameObject.Find("ammo").GetComponentInChildren <Text>(); // print("Gun-Start"); anim = GetComponent <GunAnimation>(); muzzleFlash = GetComponentInChildren <MuzzleFlash>(); audioSource = GetComponent <AudioSource>(); }
void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); player = FindObjectOfType <Player>(); gunController = FindObjectOfType <GunController>(); spawner = FindObjectOfType <Spawner>(); shotsRemainingInBurst = burstCount; projectileRemainingInMag = projectilesPerMag; }
// Use this for initialization void Start() { barrel = GetComponentInChildren <Barrel>(); hammer = GetComponentInChildren <Hammer>(); muzzleFlash = GetComponentInChildren <MuzzleFlash>(); body = GetComponentInChildren <Body>(); audioSource = GetComponent <AudioSource>(); }
private void Start() { FindObjectOfType <GunController>().OnGunChange += OnGunChange; muzzleFlash = GetComponent <MuzzleFlash>(); shotsRemainingInBurst = burstCount; projectilesRemainingInMag = projectilesPerMag; magazinesRemaining = startingMagAmount; previousMag = magazinesRemaining; }
protected virtual void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); if (transform.Find("MuzzleFlash") != null) { distToMuzzle = transform.Find("MuzzleFlash").localPosition.magnitude; } maxAmmo = totalAmmo; }
private float nextPossibleShootTime; //для определения возможности произведения выстрела private void Start() { muzzleFlash = GetComponent <MuzzleFlash>(); secondsBetweenShots = 60 / rpm; //определние частоты выстрелов, конечное if (GetComponent <LineRenderer>()) { tracer = GetComponent <LineRenderer>(); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); LaunchSound.Init(_component); Ammunition.Init(_component); MuzzleFlash.Init(_component); Recoil.Init(_component); Effect.Init(_component); }
private WaitForSeconds shotDuration = new WaitForSeconds(0.07f); // WaitForSeconds object used by our ShotEffect coroutine, determines time laser line will remain visible //private AudioSource gunAudio; // Reference to the audio source which will play our shooting sound effect // Reference to the LineRenderer component which will display our laserline public void Initialize() { // Get and store a reference to our LineRenderer component laserLine = GetComponent <LineRenderer>(); muzzleFlash = GetComponent <MuzzleFlash>(); // Get and store a reference to our AudioSource component //gunAudio = GetComponent<AudioSource>(); }
void Start() { mFlash = GetComponent<MuzzleFlash>(); mFlash.Reset(); StartCoroutine(rocketSalvoRelease()); shootableScript = GetComponent<Shootable>(); wasHealth = startHealth = shootableScript.healthLimit; hardpointRef = missionTarget.GetComponentInChildren<HardPointCounter>(); hardpointMax = hardpointRef.hardpointCount; }
void Start() { muzzleFlash = GetComponent<MuzzleFlash>(); shotsRemaingInBurst = burstCount; }
public void Initialize(MuzzleFlash muzzlePrefab) { if (_muzzleInstance != null) Destroy(_muzzleInstance.gameObject); _muzzleInstance = Utility.InstantiateInParent(muzzlePrefab.gameObject, transform).GetComponent<MuzzleFlash>(); }
// Use this for initialization void Awake() { muzzleFlash = GetComponentInChildren<MuzzleFlash>(); }
void Start() { muzzleflash = GetComponent<MuzzleFlash> (); }
void Start() { muzzleflash = GetComponent<MuzzleFlash> (); shotsRemainingInBurst = burstCount; projectilesRemainingInMag = projectilesPerMag; }
// [HideInInspector] // public AmmoGUI gui; void Start() { muzzleflash = GetComponent<MuzzleFlash>(); ammoVariables = GameObject.FindWithTag ("Player").GetComponent<AmmunitionVariables>(); shotsRemainingInBurst = burstCount; //Restock(); // currentAmmoInMag = ammoPerMag; // if (gui) { // gui.SetAmmoInfo(totalAmmo, currentAmmoInMag); // } SetAmmoVariables(); }
void Start() { rmData = GetComponent<RadarManager>(); rocketHUD = GameObject.Find ("fake weapon hud").GetComponent<Image>();; rocketHUD.gameObject.SetActive(true); SpeedReadout = GameObject.Find("Speed"); throttleReadout = GameObject.Find("Throttle"); if(optionalDangerHeightReadout) { dangerBaseText = optionalDangerHeightReadout.text; } mFlash = GetComponent<MuzzleFlash>(); mFlash.Reset(); StartCoroutine(rocketSalvoRelease()); shootableScript = GetComponent<Shootable>(); wasHealth = startHealth = shootableScript.healthLimit; UI_ThrottleReadout = throttleReadout.GetComponent<UI_Speed> (); UI_SpeedReadout = SpeedReadout.GetComponent<UI_Speed> (); hardpointRef = missionTarget.GetComponentInChildren<HardPointCounter>(); hardpointMax = hardpointRef.hardpointCount; }
// [HideInInspector] // public AmmoGUI gui; void Start() { muzzleflash = GetComponent<MuzzleFlash>(); ammoVariables = GameObject.FindGameObjectWithTag ("Player").GetComponent<AmmunitionVariables>(); shotsRemainingInBurst = burstCount; alienScream = Resources.Load ("alien-scream") as AudioClip; ammoText = GameObject.FindGameObjectWithTag("AmmoText").GetComponent<Text>() as Text; //Restock(); // currentAmmoInMag = ammoPerMag; // if (gui) { // gui.SetAmmoInfo(totalAmmo, currentAmmoInMag); // } if(gameObject.tag == "Revolver") { currentAmmo = ammoVariables.revolverCurrentAmmo; currentClip = ammoVariables.revolverCurrentClip; maxAmmo = ammoVariables.revolverMaxAmmo; maxClip = ammoVariables.revolverMaxClip; } else if(gameObject.tag == "Rifle") { currentAmmo = ammoVariables.rifleCurrentAmmo; currentClip = ammoVariables.rifleCurrentClip; maxAmmo = ammoVariables.rifleMaxAmmo; maxClip = ammoVariables.rifleMaxClip; } else if(gameObject.tag == "Shotgun") { currentAmmo = ammoVariables.shotgunCurrentAmmo; currentClip = ammoVariables.shotgunCurrentClip; maxAmmo = ammoVariables.shotgunMaxAmmo; maxClip = ammoVariables.shotgunMaxClip; } }
// Use this for initialization void Start() { m_ObjectPool = FindObjectOfType<ObjectPool>(); m_CharacterAnimator = transform.root.GetComponent<AnimatorHandler>().m_CharacterAnimator; m_RemainingShots = m_ClipSize; m_SprayOffset = Mathf.Sin(m_SprayAngle * Mathf.Deg2Rad); m_MuzzleFlash = GetComponentInChildren<MuzzleFlash>(); StartVirtual (); }