private void AlienAttack() { GameObject bullet; if(this.tag == "GunAlien") bullet = Instantiate(ResourceManager.Get().preGunLazer,this.transform.position + this.transform.TransformDirection(Vector3.up * 3), this.transform.rotation) as GameObject; else bullet = Instantiate(ResourceManager.Get().prePlasma,this.transform.position + this.transform.TransformDirection(Vector3.up * 4) + this.transform.InverseTransformDirection(Vector3.forward * 2), this.transform.rotation) as GameObject; if (bullet != null){ projectile = GetComponent<ColliderProjectile>(); } }
public void UpdateShooting() { // Shoot System // Once we're ready to make ammo limited, add this: && HUD.ammo > 0 if ((Input.GetKeyDown(KeyCode.Space)|| script_vcontroller.isJump())&& ammo > 0){ GameObject bullet = Instantiate(ResourceManager.Get().preBullet,this.transform.position + this.transform.TransformDirection(Vector3.up * 3) + this.transform.TransformDirection(Vector3.forward * 2) + this.transform.InverseTransformDirection(Vector3.left * 1.7f), this.transform.rotation) as GameObject; if (bullet != null){ projectile = bullet.GetComponentInChildren<ColliderProjectile>(); if(GetComponent<CharacterController>().velocity != Vector3.zero) projectile.speed += speedMove; } ammo--; } }