Ejemplo n.º 1
0
    IEnumerator FastShoot()
    {
        yield return(new WaitForSeconds(TimeRemaningPowerUp));

        typePower            = powerUp.empty; //set state after timer
        shootScript.timeshot = 1f;            //set value of fire rate
    }
Ejemplo n.º 2
0
 // 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);
     }
 }
Ejemplo n.º 3
0
    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;
        }
    }
Ejemplo n.º 5
0
 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());
 }
Ejemplo n.º 6
0
    IEnumerator YieldMovement()
    {
        yield return(new WaitForSeconds(4f));

        Debug.Log("Posle yield");
        navAgent.speed = 0.5f;
        currentPowerUp = powerUp.None;
        ////SoundManager.instance.musicSource.pitch = 1f;
    }
Ejemplo n.º 7
0
    // 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;
        }
    }
Ejemplo n.º 8
0
    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");
    }
Ejemplo n.º 9
0
    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);
        }
    }
Ejemplo n.º 10
0
    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());
         * }*/
    }
Ejemplo n.º 11
0
        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;
            }
        }
Ejemplo n.º 12
0
 public void Shield()
 {
     typePower = powerUp.empty;//set state after timer
     shield.SetActive(false);
 }
Ejemplo n.º 13
0
    private void Start()
    {
        shootScript = GameObject.Find("Spaceship Galaga white").GetComponent <shoot>(); // get component script in player

        typePower = powerUp.empty;                                                      //set empty state
    }
Ejemplo n.º 14
0
    IEnumerator DoubleShoot() //timer power up
    {
        yield return(new WaitForSeconds(TimeRemaningPowerUp));

        typePower = powerUp.empty; //set state after timer
    }
Ejemplo n.º 15
0
    IEnumerator TripleShoot()
    {
        yield return(new WaitForSeconds(TimeRemaningPowerUp)); //set state after timer

        typePower = powerUp.empty;                             //set state after timer
    }
Ejemplo n.º 16
0
 // Start is called before the first frame update
 void Start()
 {
     currentDay     = Days.sun;
     currentPowerUp = powerUp.speed;
 }
Ejemplo n.º 17
0
 : this(duration, definition, new ElementWithTarget(powerUp, definition.PowerUpDefinition?.TargetAttribute ?? throw new InvalidOperationException($"MagicEffectDefinition {definition.GetId()} has no target attribute.")))
Ejemplo n.º 18
0
    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);
        }
    }
Ejemplo n.º 19
0
    // 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);
    }