Пример #1
0
    private void Shoot(BasicColors color)
    {
        timeSinceLastShot = Time.time;
        float x    = gunX;
        bool  left = !playerMovement.GetFacing();

        if (left)
        {
            x = -gunX;
        }
        playerSounds.playShoot();
        Transform bull = Object.Instantiate(bullet, new Vector3(transform.position.x + x, transform.position.y + gunHeight, -1), new Quaternion()).transform;

        bull.GetComponent <Bullet> ().Initialize(color, regularDamage, left);
    }
Пример #2
0
    public void Initialize(BasicColors color, int damage, bool left)
    {
        this.color  = color;
        this.damage = damage;
        SetColor();

        if (left)
        {
            direction = -Vector3.right;
        }
        else
        {
            direction = Vector3.right;
        }

        GetComponent <Rigidbody2D> ().velocity = new Vector2();
    }
Пример #3
0
    public void Initialize(int lifePoints, bool combined)
    {
        filling   = GetComponent <EnemySpriteManager> ().filling;
        border    = GetComponent <EnemySpriteManager> ().border;
        maxHealth = lifePoints;
        switch (Random.Range(0, 3))
        {
        case 0:
            if (!combined)
            {
                color = BasicColors.AMARILLO;
            }
            else
            {
                color = BasicColors.NARANJA;
            }
            break;

        case 1:
            if (!combined)
            {
                color = BasicColors.ROJO;
            }
            else
            {
                color = BasicColors.VERDE;
            }
            break;

        case 2:
            if (!combined)
            {
                color = BasicColors.AZUL;
            }
            else
            {
                color = BasicColors.MORADO;
            }
            break;
        }
        SetHealth();
        SetColor();
    }
Пример #4
0
    public bool Hit(/*Bullet bullet*/ BasicColors bulletColor, int bulletDamage)
    {
        bool hit = false;

        //BasicColors bulletColor = bullet.getBulletColor ();
        //int bulletDamage = bullet.getDamage ();

        switch (color)
        {
        case BasicColors.AMARILLO:
            if (bulletColor == BasicColors.AMARILLO)
            {
                Y    -= bulletDamage;
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)Y / maxHealth);
                hit   = true;
            }
            break;

        case BasicColors.ROJO:
            if (bulletColor == BasicColors.ROJO)
            {
                R    -= bulletDamage;
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)R / maxHealth);
                hit   = true;
            }
            break;

        case BasicColors.AZUL:
            if (bulletColor == BasicColors.AZUL)
            {
                B    -= bulletDamage;
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)B / maxHealth);
                hit   = true;
            }
            break;

        case BasicColors.NARANJA:
            if (bulletColor == BasicColors.AMARILLO && Y > 0)
            {
                Y -= bulletDamage;
                if (Y <= 0)
                {
                    color = BasicColors.ROJO;
                }
                hit = true;
            }
            else if (bulletColor == BasicColors.ROJO && R > 0)
            {
                R -= bulletDamage;
                if (R <= 0)
                {
                    color = BasicColors.AMARILLO;
                }
                hit = true;
            }
            if (hit)
            {
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)Mathf.Max(Y, R) / maxHealth);
            }
            break;

        case BasicColors.MORADO:
            if (bulletColor == BasicColors.ROJO && R > 0)
            {
                R -= bulletDamage;
                if (R <= 0)
                {
                    color = BasicColors.AZUL;
                }
                hit = true;
            }
            else if (bulletColor == BasicColors.AZUL && B > 0)
            {
                B -= bulletDamage;
                if (B <= 0)
                {
                    color = BasicColors.ROJO;
                }
                hit = true;
            }

            if (hit)
            {
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)Mathf.Max(R, B) / maxHealth);
            }
            break;

        case BasicColors.VERDE:
            if (bulletColor == BasicColors.AMARILLO && Y > 0)
            {
                Y -= bulletDamage;
                if (Y <= 0)
                {
                    color = BasicColors.AZUL;
                }
                hit = true;
            }
            else if (bulletColor == BasicColors.AZUL && B > 0)
            {
                B -= bulletDamage;
                if (B <= 0)
                {
                    color = BasicColors.AMARILLO;
                }
                hit = true;
            }

            if (hit)
            {
                alpha = Mathf.Lerp(maxTransparency, 1f, (float)Mathf.Max(Y, B) / maxHealth);
            }
            break;

        case BasicColors.NEGRO:
            // TODO
            break;
        }

        if (hit)
        {
            SetColor();
        }

        if (Y <= 0 && R <= 0 && B <= 0)
        {
            Die();
        }

        return(hit);
    }
Пример #5
0
        public void Change_Lights_To_Maroon()
        {
            var maroon = BasicColors.GetCustomColor(128, 0, 0);

            _lightController.ChangeLights(maroon);
        }