public override void Start() { base.Start(); projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.ShotgunLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.ShotgunLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.ShotgunLevel2], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } sound = new AudioClip[1] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire01]) }; reloadClip = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.MachineGunReload02]); SetLevel(0); burstDelay = 0.00000000f; minimumSpreadAngle = 0.0f; maximumSpreadAngle = 16.0f; burstFireWeapon = true; }
public override void Start() { projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightAutoLaserBullet], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightAutoLaserBullet], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightAutoLaserBullet], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } //sound = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.PlasmaGunFire]); SetLevel(0); base.Start(); }
public override void Start() { projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightCannonBulletLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightCannonBulletLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.LightCannonBulletLevel2], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } sound = new AudioClip[1] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.LightCannonFire01]) }; reloadClip = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.MachineGunReload02]); SetLevel(0); minimumSpreadAngle = 0.1f; maximumSpreadAngle = 2.5f; burstSize = 1; }
public override void Start() { base.Start(); projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.PlasmaBulletLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.PlasmaBulletLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.PlasmaBulletLevel2], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } sound = new AudioClip[2] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.PlasmaGunFire01]), Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.PlasmaGunFire02]), }; reloadClip = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.PlasmaReload01]); SetLevel(0); burstFireWeapon = true; }
public override void Start() { projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.RocketBulletLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.RocketBulletLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.RocketBulletLevel2], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } sound = new AudioClip[1] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.RocketFire01]) }; SetLevel(0); burstFireWeapon = false; }
public override void Start() { projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.SniperBulletLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.SniperBulletLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.SniperBulletLevel2], typeof(ProjectileBaseScript)) }; //for (int i = 0; i < projectileType.Length; i++) //{ // ObjectPool.CreatePool(projectileType[i]); //} sound = new AudioClip[1] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.SniperFire01]), //Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.PlasmaGunFire02]), }; reloadClip = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.MachineGunReload02]); SetLevel(0); casing = Resources.Load<ShellCasing>(KBConstants.ObjectConstants.PREFAB_NAMES[KBConstants.ObjectConstants.type.SniperShellCasing]); if (casing != null) { ObjectPool.CreatePool(casing); } base.Start(); burstFireWeapon = true; }
public override void Start() { base.Start(); projectileType = new ProjectileBaseScript[3] { (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.HeavyCannonBulletLevel0], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.HeavyCannonBulletLevel1], typeof(ProjectileBaseScript)), (ProjectileBaseScript)Resources.Load(ObjectConstants.PREFAB_NAMES[ObjectConstants.type.HeavyCannonBulletLevel2], typeof(ProjectileBaseScript)) }; for (int i = 0; i < projectileType.Length; i++) { ObjectPool.CreatePool(projectileType[i]); } sound = new AudioClip[5] { Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire01]), Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire02]), Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire03]), Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire04]), Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.CannonFire05]), }; reloadClip = Resources.Load<AudioClip>(AudioConstants.CLIP_NAMES[AudioConstants.clip.MachineGunReload02]); //audio.clip = sound; SetLevel(0); burstFireWeapon = true; casing = Resources.Load<ShellCasing>(KBConstants.ObjectConstants.PREFAB_NAMES[KBConstants.ObjectConstants.type.HCannonShellCasing]); if (casing != null) { ObjectPool.CreatePool(casing); } }
private IEnumerator DoFiringCoroutine(Vector3 direction, KBPlayer firedBy, float _inheritSpeed = 0.0f) { if (sound.Length > 0) { audio.PlayOneShot(sound[Random.Range(0, sound.Length)]); } if (particleSystem != null) { StartCoroutine(ParticleBurstStaged()); } for (int i = 0; i < burstSize; i++) { if (owner.networkPlayer.isLocal) { switch (level) { case 0: Camera.main.GetComponent<ScreenShake>().StartShake(0.1000f, 1.0000f); break; case 1: Camera.main.GetComponent<ScreenShake>().StartShake(0.1000f, 1.5000f); break; case 2: Camera.main.GetComponent<ScreenShake>().StartShake(0.1000f, 2.3000f); break; default: Camera.main.GetComponent<ScreenShake>().StartShake(0.0500f, 0.500f); break; } } if (casing != null) { if (burstDelay > 0.0f) { SpawnShellCasing(100.0f); } else { if (i == 0) { SpawnShellCasing(130.0f); } } } ProjectileBaseScript projectile = null; Vector3 modifiedDirection = direction; if (burstFireWeapon) { modifiedDirection.y = (direction.y - maximumSpreadAngle) + (i * 2.0f * maximumSpreadAngle / burstSize); } // Spawn projectile projectile = ObjectPool.Spawn(projectileType[level], transform.position, Quaternion.Euler(modifiedDirection)); projectile.inheritSpeed = _inheritSpeed; projectile.Team = firedBy.Team; projectile.Init(firedBy); projectile.lifetime = 100.0f; projectile.setLifetimeForMaxRange(maxRange); projectile.damage = projectile.damageLevel[level]; Collider[] collider = owner.GetComponentsInChildren<Collider>(); foreach (Collider c in collider) { if (c.enabled && projectile.collider.enabled) { Physics.IgnoreCollision(c, projectile.collider, true); } } // Alter behavior if special projectile type if (projectile.homingProjectile) { projectile.targetPlayer = GameManager.Instance.FindClosestPlayer(owner, 10, true); } if (projectile.aimedProjectile) { projectile.targetPosition = new Vector3(-owner.mousePlayerDiff.x, owner.transform.position.y, -owner.mousePlayerDiff.y); } // Play effects lastProjectile = projectile; if (i < burstSize) { if (burstDelay > 0.0f) { yield return new WaitForSeconds(burstDelay); } } else if (burstDelay == 0) { yield return new WaitForEndOfFrame(); } StartCoroutine(owner.GamepadVibrateTriggers(0.1250f)); } }