IEnumerator FastShoot() { yield return(new WaitForSeconds(TimeRemaningPowerUp)); typePower = powerUp.empty; //set state after timer shootScript.timeshot = 1f; //set value of fire rate }
// Metodo para cambiar el powerUp activo del inventario public void ChangePowerUp(string newPowerUp, PowerUpManager pum1) { pum = pum1; // si el powerUp está vacío se selecciona el nuevo y se muestra en el hud if (myPowerUp == powerUp.Empty) { if (newPowerUp == "IncreaseDamage") { myPowerUp = powerUp.IncreaseDamage; } else if (newPowerUp == "Sandwich") { myPowerUp = powerUp.Sandwich; } else if (newPowerUp == "ExtraVelocity") { myPowerUp = powerUp.ExtraVelocity; } else { Debug.Log("nombre erroneo de power up"); } PowerUpAppears(true); } }
IEnumerator DoubleScore() { yield return(new WaitForSeconds(TimeRemaningPowerUp)); typePower = powerUp.empty;//set state after timer pointsDouble = false; }
public void ActivatePowerUp(int ind) { switch (ind) { case 1: if (mana > manaValue * 2) { PUPCloseBtn.SetActive(false); BackBtn.SetActive(true); activePowerUp = powerUp.ARROW_STORM; foreach (GameObject j in ArrowStormOptions) { j.SetActive(true); } } break; case -1: if (ArrowStormOptions.Length != 1) //fix thissssssssssssssss its stupid af //ThrowingController.INSTANCE.PUpSelectionMode(false); { GameManager.instance.PUpSelectionMode(false); } else //fix thissssssssssssssss its stupid af { GameObject.Find("PowerUpAux").SetActive(false); } foreach (GameObject j in ArrowStormOptions) { j.SetActive(false); } break; case 2: if (mana >= manaValue * 3) { PUPButtons.SetActive(false); //ThrowingController.INSTANCE.PUpSelectionMode(false); GameManager.instance.PUpSelectionMode(false); ActualizeMana(-manaValue * 3); //ThrowingController.currentHealth += 50; //ThrowingController.INSTANCE.ActualizeHealth(); GameManager.currentHealth += 50; GameManager.instance.ActualizeHealth(); } break; case -100: BackBtn.SetActive(false); PUPCloseBtn.SetActive(true); activePowerUp = powerUp.SELECTING; foreach (GameObject j in ArrowStormOptions) { j.SetActive(false); } break; } }
public void PowerUpMovement() { navAgent.speed = 1f; currentPowerUp = powerUp.Speed; // Just changing the pitch sounds a bit weird //SoundManager.instance.musicSource.pitch = 1.1f; StartCoroutine(YieldMovement()); StartCoroutine(ChangeColor()); }
IEnumerator YieldMovement() { yield return(new WaitForSeconds(4f)); Debug.Log("Posle yield"); navAgent.speed = 0.5f; currentPowerUp = powerUp.None; ////SoundManager.instance.musicSource.pitch = 1f; }
// metodo que llama al powerUp manager para activar el powerUp public void ActivatePowerUp() { string newPowerUp; if (!IsEmpty()) { newPowerUp = myPowerUp.ToString(); PowerUpAppears(false); pum.ActivatePowerUp(newPowerUp); myPowerUp = powerUp.Empty; } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "powerUp") { powerUp choice = collision.gameObject.GetComponent <powerUp>(); if (choice.counter < counter) { Destroy(gameObject); } } Debug.Log("SHIT"); }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "powerUp") { powerUp newpower = collision.gameObject.GetComponent <powerUp>(); currentBullet = (bulletType)newpower.currentPower; switch (currentBullet) { case bulletType.normal: { currentAmmo = 10; break; } case bulletType.bouncy: { currentAmmo = 10; break; } case bulletType.explosive: { currentAmmo = 4; break; } case bulletType.fast: { currentAmmo = 7; break; } case bulletType.spread: { currentAmmo = 10; break; } case bulletType.burst: { currentAmmo = 5; break; } } Destroy(collision.gameObject); } }
private void Drop() { float rnd = Random.Range(0f, 1f); //random what powerup to drop: if (rnd < 0.5f) { // random power up int randomInt = Random.Range(0, 7); // 7 different powerups powerUp pu = powerUpDrop.GetComponent <powerUp>(); pu.type = randomInt; Instantiate(powerUpDrop, this.transform.position, new Quaternion()); } /* else if(rnd<0.6) //the upgrade bullet power up * { * powerUp pu = powerUpDrop.GetComponent<powerUp>(); * pu.type = 4; * Instantiate(powerUpDrop, this.transform.position, new Quaternion()); * }*/ }
public void CreatePowerup(Player player, Timer timer) { if (timer.finished == true && existing == false) { Random randNum; randNum = new Random(); type = randNum.Next(1, 4); rectangle = new Rectangle(randNum.Next(0, 800), randNum.Next(0, 400), 32, 32); powerTimer = new Timer(0); switch (type) { case 1: thisPowerup = powerUp.DOUBLEJUMP; break; case 2: thisPowerup = powerUp.FIRERATE; break; case 3: thisPowerup = powerUp.SPEED; break; } existing = true; visible = true; timer.timer = 20; timer.finished = false; } if (visible == true && timer.finished == true) { visible = false; existing = false; timer.timer = 20; timer.finished = false; } }
public void Shield() { typePower = powerUp.empty;//set state after timer shield.SetActive(false); }
private void Start() { shootScript = GameObject.Find("Spaceship Galaga white").GetComponent <shoot>(); // get component script in player typePower = powerUp.empty; //set empty state }
IEnumerator DoubleShoot() //timer power up { yield return(new WaitForSeconds(TimeRemaningPowerUp)); typePower = powerUp.empty; //set state after timer }
IEnumerator TripleShoot() { yield return(new WaitForSeconds(TimeRemaningPowerUp)); //set state after timer typePower = powerUp.empty; //set state after timer }
// Start is called before the first frame update void Start() { currentDay = Days.sun; currentPowerUp = powerUp.speed; }
: this(duration, definition, new ElementWithTarget(powerUp, definition.PowerUpDefinition?.TargetAttribute ?? throw new InvalidOperationException($"MagicEffectDefinition {definition.GetId()} has no target attribute.")))
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "powerUp") { audio.PlayOneShot(powerUpSound); powerUp newpower = collision.gameObject.GetComponent <powerUp>(); currentBullet = (bulletType)newpower.currentPower; hasReloaded = true; reloadTimer = reloadSpeed; switch (currentBullet) { case bulletType.normal: { maxAmmo = 10; currentAmmo = 10; gunType.sprite = normalGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } case bulletType.bouncy: { maxAmmo = 10; currentAmmo = 10; gunType.sprite = bounceGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } case bulletType.explosive: { maxAmmo = 4; currentAmmo = 4; gunType.sprite = explosiveGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } case bulletType.fast: { maxAmmo = 7; currentAmmo = 7; gunType.sprite = fastGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } case bulletType.spread: { maxAmmo = 10; currentAmmo = 10; gunType.sprite = spreadGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } case bulletType.burst: { maxAmmo = 5; currentAmmo = 5; gunType.sprite = burstGun; ammoTracker.fillAmount = maxAmmo / maxAmmo; break; } } Destroy(collision.gameObject); } }
// Update is called once per frame public virtual void Update() { //update colors if (gameSettings.GetComponent <GameSettings>().playerColors.Length >= 2) { ParticleSystemRenderer ren = GetComponentInChildren <ParticleSystemRenderer>(); ren.material.color = ren.trailMaterial.color = gameSettings.GetComponent <GameSettings>().playerColors[playerNumber]; } //update speeds float tempSpeed = MOVEMENT_SPEED; float tempMax = MAX_SPEED; if (myPowerUp != powerUp.NONE) { timer += Time.deltaTime; } if (timer > 5) { timer = 0; myPowerUp = powerUp.NONE; } if (myPowerUp == powerUp.SPEED) { tempSpeed += 1; tempMax += 1; } if (myPowerUp == powerUp.WIND) { GetComponent <SphereCollider>().radius = PLAYER_WIND_RADIUS; ParticleSystem ps = GetComponentInChildren <ParticleSystem>(); ParticleSystem.ShapeModule shape = ps.shape; shape.radius = PLAYER_PARTICLE_WIND_RADIUS; ParticleSystem.EmissionModule emit = ps.emission; emit.rateOverTime = PLAYER_EMIT_WIND; } else { GetComponent <SphereCollider>().radius = PLAYER_RADIUS; ParticleSystem ps = GetComponentInChildren <ParticleSystem>(); ParticleSystem.ShapeModule shape = ps.shape; shape.radius = PLAYER_PARTICLE_WIND_RADIUS; ParticleSystem.EmissionModule emit = ps.emission; emit.rateOverTime = PLAYER_EMIT; } int verticalMovement = 0; int horizontalMovement = 0; #if UNITY_STANDALONE if (Input.GetKey(thisMovement[MOVE_UP])) { verticalMovement += 1; } if (Input.GetKey(thisMovement[MOVE_DOWN])) { verticalMovement -= 1; } if (Input.GetKey(thisMovement[MOVE_RIGHT])) { horizontalMovement += 1; } if (Input.GetKey(thisMovement[MOVE_LEFT])) { horizontalMovement -= 1; } #endif //Controls for Android devices #if UNITY_ANDROID Touch touch = Input.GetTouch(0); if (!touch.Equals(null)) { horizontalMovement = (int)(touch.deltaPosition.x); verticalMovement = (int)(touch.deltaPosition.y); } #endif xVel += horizontalMovement * tempSpeed * Time.deltaTime; yVel += verticalMovement * tempSpeed * Time.deltaTime; if (horizontalMovement == 0) { xVel -= Time.deltaTime * MOVEMENT_FRICTION * Mathf.Sign(xVel); } if (verticalMovement == 0) { yVel -= Time.deltaTime * MOVEMENT_FRICTION * Mathf.Sign(yVel); } if (Mathf.Abs(xVel) > tempMax) { xVel = tempMax * Mathf.Sign(xVel); } if (Mathf.Abs(xVel) < 0.2f && horizontalMovement == 0) { xVel = 0; } if (Mathf.Abs(yVel) > tempMax) { yVel = tempMax * Mathf.Sign(yVel); } if (Mathf.Abs(yVel) < 0.2f && verticalMovement == 0) { yVel = 0; } Vector3 move = (Vector3.up * yVel) + (Vector3.right * xVel); //move.Normalize(); gameObject.transform.Translate(move); }