public void fire(FireProps fireProps, BulletManager bm, WeaponHandling wh) { switch (playerInfo.charEnum) { case CharacterEnum.Tesla: specialInstance.SetActive(true); specialInstance.GetComponent <WeaponSpecialTeslaLogic>().fire(); break; case CharacterEnum.Curie: specialInstance.SetActive(true); specialInstance.GetComponent <WeaponSpecialCurieLogic>().fire(fireProps); break; case CharacterEnum.DaVinci: specialInstance.GetComponent <WeaponSpecialDaVinciLogic>().fire(fireProps, wh); specialInstance.SetActive(true); //specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire(); break; case CharacterEnum.Einstein: specialInstance.SetActive(true); specialInstance.GetComponent <WeaponSpecialEinsteinLogic>().fire(fireProps); break; case CharacterEnum.Nobel: specialInstance.SetActive(true); specialInstance.GetComponent <WeaponSpecialNobelLogic>().fire(fireProps); break; } }
public void fire(FireProps fireProps, BulletManager bm, WeaponHandling wh) { switch (playerInfo.charEnum) { case CharacterEnum.Tesla: specialInstance.SetActive(true); specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire(); break; case CharacterEnum.Curie: specialInstance.SetActive(true); specialInstance.GetComponent<WeaponSpecialCurieLogic>().fire(fireProps); break; case CharacterEnum.DaVinci: specialInstance.GetComponent<WeaponSpecialDaVinciLogic>().fire(fireProps, wh); specialInstance.SetActive(true); //specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire(); break; case CharacterEnum.Einstein: specialInstance.SetActive(true); specialInstance.GetComponent<WeaponSpecialEinsteinLogic>().fire(fireProps); break; case CharacterEnum.Nobel: specialInstance.SetActive(true); specialInstance.GetComponent<WeaponSpecialNobelLogic>().fire(fireProps); break; } }
public Bullet iniciate(FireProps fp) { this.fp = fp; damage = fp.damage; direction = new Vector2(fp.direction.x, fp.direction.y); bulletSpeed = fp.bulletSpeed; if (fp.weapEnum != WeaponEnum.mine && fp.weapEnum != WeaponEnum.specialNobel) { if (fp.direction == Vector2.up) { transform.position = fp.position + new Vector2(0.1f, 0.35f); transform.rotation = Quaternion.Euler(0, 0, -90); } else if (fp.direction == Vector2.down) { transform.position = fp.position + new Vector2(-0.1f, -0.75f); transform.rotation = Quaternion.Euler(0, 0, 90); } else if (fp.direction == Vector2.left) { transform.position = fp.position + new Vector2(direction.normalized.x * 0.5f, -0.17f); transform.rotation = Quaternion.Euler(0, 0, 0); } else if (fp.direction == Vector2.right) { transform.position = fp.position + new Vector2(direction.normalized.x * 0.5f, -0.22f); transform.rotation = Quaternion.Euler(0, 0, 180); } } else { transform.position = fp.position; Collider2D c2D = GetComponent <Collider2D>(); Vector2 ofset = c2D.offset; ofset.y -= 0.3f; c2D.offset = ofset; } animator = GetComponent <Animator>(); animator.runtimeAnimatorController = fp.animController; //load hitSound string soundLoaderString = "Sounds/Weapon/"; string hitSoundString = fp.weapon + "Hit"; if (Resources.Load(soundLoaderString + hitSoundString) != null) { hitSound = Resources.Load(soundLoaderString + hitSoundString) as AudioClip; } gameObject.SetActive(true); isActive = true; StartCoroutine(delayOnPlant()); return(this); }
public Bullet iniciate(FireProps fp) { this.fp = fp; damage = fp.damage; direction = new Vector2(fp.direction.x, fp.direction.y); bulletSpeed = fp.bulletSpeed; if (fp.weapEnum != WeaponEnum.mine && fp.weapEnum != WeaponEnum.specialNobel) { if (fp.direction == Vector2.up) { transform.position = fp.position + new Vector2(0.1f, 0.35f); transform.rotation = Quaternion.Euler(0, 0, -90); } else if (fp.direction == Vector2.down) { transform.position = fp.position + new Vector2(-0.1f, -0.75f); transform.rotation = Quaternion.Euler(0, 0, 90); } else if (fp.direction == Vector2.left) { transform.position = fp.position + new Vector2(direction.normalized.x*0.5f, -0.17f); transform.rotation = Quaternion.Euler(0, 0, 0); } else if (fp.direction == Vector2.right) { transform.position = fp.position + new Vector2(direction.normalized.x * 0.5f, -0.22f); transform.rotation = Quaternion.Euler(0, 0, 180); } } else { transform.position = fp.position; Collider2D c2D = GetComponent<Collider2D>(); Vector2 ofset = c2D.offset; ofset.y -= 0.3f; c2D.offset = ofset; } animator = GetComponent<Animator>(); animator.runtimeAnimatorController = fp.animController; //load hitSound string soundLoaderString = "Sounds/Weapon/"; string hitSoundString = fp.weapon + "Hit"; if (Resources.Load(soundLoaderString + hitSoundString) != null) hitSound = Resources.Load(soundLoaderString + hitSoundString) as AudioClip; gameObject.SetActive(true); isActive = true; StartCoroutine(delayOnPlant()); return this; }
public FireProps(FireProps fp) { this.direction = fp.direction; this.position = fp.position; this.animController = fp.animController; this.bulletSpeed = fp.bulletSpeed; this.damage = fp.damage; this.weapon = fp.weapon; this.weapEnum = fp.weapEnum; }
public void fire(FireProps fp) { fireProps = fp; if (usedBullets.Count <= 5) { Bullet b = bulletManager.fire(fireProps); usedBullets.Add(b); } }
public void fire(Vector2 direction) { if (!shootingEnabled) return; if (!activeWeapon.readyToFire || !activeWeapon.kadReady) return; activeWeapon.kadReady = false; //handle if active weapon is pistol (character is not specified in WeaponEnum) string weapon; if (activeWeapon.ToString() == "pistol") weapon = player.playInfo.charEnum.ToString() + "Pistol"; else weapon = activeWeapon.ToString(); FireProps fireProps = new FireProps( new Vector2(direction.x, direction.y), transform.position, activeWeapon.animController, activeWeapon.bulletSpeed, activeWeapon.damage, weapon, activeWeapon.weaponType ); int bulletsLeft = activeWeapon.ammo; if (bulletsLeft > 0) { SoundManager.instance.RandomizeSfx(activeWeapon.fireSound_01); if (activeWeapon.isSpecial) { specialWeapon.fire(fireProps, buletManager, this); bulletsLeft = activeWeapon.fire(); } else { if (activeWeapon.weaponType == WeaponEnum.flamethrower) { flamethrower.fire(fireProps, player, activeWeapon); } else { buletManager.fire(fireProps); } bulletsLeft = activeWeapon.fire(); } } if (bulletsLeft == 0) { RemoveFromInv(); } }
public void fire(FireProps fp) { animator.SetBool("returnToOrig", true); nullAllAnimBools(); transform.localScale = new Vector3(1, 1, 1); fireProps = fp; fireProps2 = new FireProps(fp); moveInShootingDirection(); fall = false; update = true; //renderer.sprite = spriteMapping[fp.direction]; setBoolAnimator(animatorDirectionMapping[fp.direction], true); chosenAudioSourceIndex = SoundManager.instance.PlaySingle(carSound, true); }
public void fire(FireProps fp) { animator.SetBool("returnToOrig", true); nullAllAnimBools(); transform.localScale = new Vector3(1,1,1); fireProps = fp; fireProps2 = new FireProps(fp); moveInShootingDirection(); fall = false; update = true; //renderer.sprite = spriteMapping[fp.direction]; setBoolAnimator(animatorDirectionMapping[fp.direction], true); chosenAudioSourceIndex = SoundManager.instance.PlaySingle(carSound, true); }
public void fire(FireProps fp) { // set flags and properties fireProps = fp; update = true; impact = false; alpha = 1; x = 1; SetIniciatePosition(); transform.rotation = Quaternion.Euler(0, 0, -90); // set animator state to begin nullAllAnimBools(); animator.SetBool("exitBoom", true); // set iniciate position setBoolAnimator("iniciate", true); }
public void fire(FireProps fp, WeaponHandling wh) { transform.position = fp.position; this.wh = wh; nullAllAnimBools(); animator.SetBool("returnToOrig", true); nullAllAnimBools(); animator.SetBool("startTank", true); hp = 100; fireProps = fp; update = true; exClicks = wb.existingClicks; wh.shootingEnabled = false; oldSpeed = playerBase.speed; playerBase.speed = fp.bulletSpeed; //playerBase.gameObject.GetComponent<Collider2D>().enabled = false; GetComponent <Collider2D>().enabled = true; }
public void fire(FireProps fp, WeaponHandling wh) { transform.position = fp.position; this.wh = wh; nullAllAnimBools(); animator.SetBool("returnToOrig", true); nullAllAnimBools(); animator.SetBool("startTank", true); hp = 100; fireProps = fp; update = true; exClicks = wb.existingClicks; wh.shootingEnabled = false; oldSpeed = playerBase.speed; playerBase.speed = fp.bulletSpeed; //playerBase.gameObject.GetComponent<Collider2D>().enabled = false; GetComponent<Collider2D>().enabled = true; }
public void fire(FireProps fp, PlayerBase pb, WeaponBase wb) { this.pb = pb; this.fp = fp; this.wb = wb; fired = true; colider.enabled = true; nullAllAnimBools(); setBoolAnimator("flameStart", true); if (!pb.isAi) { chosenAudioSourceIndex = SoundManager.instance.PlaySingle(flamethrowerSound, true); } else if (pb.isAi && !soundLoop) { chosenAudioSourceIndex = SoundManager.instance.PlaySingle(flamethrowerSound, true); soundLoop = true; } }
public void fire(FireProps fp, PlayerBase pb, WeaponBase wb) { this.pb = pb; this.fp = fp; this.wb = wb; fired = true; colider.enabled = true; nullAllAnimBools(); setBoolAnimator("flameStart", true); if (!pb.isAi) { chosenAudioSourceIndex = SoundManager.instance.PlaySingle(flamethrowerSound, true); } else if(pb.isAi && !soundLoop) { chosenAudioSourceIndex = SoundManager.instance.PlaySingle(flamethrowerSound, true); soundLoop = true; } }
public Bullet fire(FireProps fp) { while (prefabBullets[indexUsedBullet].activeInHierarchy) { if (prefabBullets[indexUsedBullet].GetComponent <Bullet>().fp.weapEnum == WeaponEnum.mine || prefabBullets[indexUsedBullet].GetComponent <Bullet>().fp.weapEnum == WeaponEnum.specialNobel) { indexUsedBullet = (indexUsedBullet + 1) % maxBullets; } else { break; } } Bullet b = prefabBullets[indexUsedBullet].GetComponent <Bullet>().iniciate( fp ); indexUsedBullet = (indexUsedBullet + 1) % maxBullets; return(b); }
public Bullet fire(FireProps fp) { while (prefabBullets[indexUsedBullet].activeInHierarchy) { if (prefabBullets[indexUsedBullet].GetComponent<Bullet>().fp.weapEnum == WeaponEnum.mine || prefabBullets[indexUsedBullet].GetComponent<Bullet>().fp.weapEnum == WeaponEnum.specialNobel) { indexUsedBullet = (indexUsedBullet + 1)%maxBullets; } else { break; } } Bullet b = prefabBullets[indexUsedBullet].GetComponent<Bullet>().iniciate( fp ); indexUsedBullet = (indexUsedBullet + 1) % maxBullets; return b; }
public void fire(Vector2 direction) { if (!shootingEnabled) { return; } if (!activeWeapon.readyToFire || !activeWeapon.kadReady) { return; } activeWeapon.kadReady = false; //handle if active weapon is pistol (character is not specified in WeaponEnum) string weapon; if (activeWeapon.ToString() == "pistol") { weapon = player.playInfo.charEnum.ToString() + "Pistol"; } else { weapon = activeWeapon.ToString(); } FireProps fireProps = new FireProps( new Vector2(direction.x, direction.y), transform.position, activeWeapon.animController, activeWeapon.bulletSpeed, activeWeapon.damage, weapon, activeWeapon.weaponType ); int bulletsLeft = activeWeapon.ammo; if (bulletsLeft > 0) { SoundManager.instance.RandomizeSfx(activeWeapon.fireSound_01); if (activeWeapon.isSpecial) { specialWeapon.fire(fireProps, buletManager, this); bulletsLeft = activeWeapon.fire(); } else { if (activeWeapon.weaponType == WeaponEnum.flamethrower) { flamethrower.fire(fireProps, player, activeWeapon); } else { buletManager.fire(fireProps); } bulletsLeft = activeWeapon.fire(); } } if (bulletsLeft == 0) { RemoveFromInv(); } }