Esempio n. 1
0
    public void newStain(GameObject stain, PaintColors color)
    {
        switch (color)
        {
        case PaintColors.red:
            DPSList.Add(stain);
            break;

        case PaintColors.cyan:
            HealList.Add(stain);
            break;

        case PaintColors.blue:
            PortalList.Add(stain);
            break;

        case PaintColors.green:
            JumpList.Add(stain);
            break;

        case PaintColors.orange:
            TimeList.Add(stain);
            break;

        case PaintColors.pink:
            //aqui no se puede llegar pero por si acaso:
            print(color);
            break;

        default:
            break;
        }
    }
Esempio n. 2
0
 //only call this first time player presses a 1,2,3
 private void ChangeColor()
 {
     ui.GetComponent <HealthUI>().ResetBar();
     if (Input.GetKey(KeyCode.Alpha1) && Input.GetKey(KeyCode.Alpha2) && Input.GetKey(KeyCode.Alpha3))
     {
         Debug.Log("Black not implemented");
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         /*if (Input.GetKey(KeyCode.Alpha2))
          * {
          *  Debug.Log("switching to purple");
          *  currColor = PaintColors.Purple;
          * } else if (Input.GetKey(KeyCode.Alpha3))
          * {
          *  Debug.Log("switching to Green");
          *  currColor = PaintColors.Green;
          * }
          * else
          * {*/
         Debug.Log("switching to blue");
         currColor = PaintColors.Blue;
         //}
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         /*if (Input.GetKey(KeyCode.Alpha3))
          * {
          *  Debug.Log("switching to Orange");
          *  currColor = PaintColors.Orange;
          * }
          * else
          * {*/
         Debug.Log("switching to red");
         currColor = PaintColors.Red;
         //}
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         Debug.Log("switching to yellow");
         currColor = PaintColors.Yellow;
     }
     else if (Input.GetKeyDown(KeyCode.Alpha4))
     {
         Debug.Log("switching to Orange");
         currColor = PaintColors.Orange;
     }
     else if (Input.GetKeyDown(KeyCode.Alpha5))
     {
         Debug.Log("switching to Green");
         currColor = PaintColors.Green;
     }
     else if (Input.GetKey(KeyCode.Alpha6))
     {
         Debug.Log("switching to purple");
         currColor = PaintColors.Purple;
     }
     ui.GetComponent <HealthUI>().ChangeBar(paintPrefabs[currColor]);
 }
Esempio n. 3
0
    //Function called from Button when clicked with right mouse button;
    public void RightWheelClick(int button)
    {
        if (button != leftButtonSelected)
        {
            transform.GetChild(2).GetChild(1).GetComponent <Image>().color = GetColor(ChoiceColor(button));
            rightButtonSelected = button;

            rightPaint = ChoiceColor(button);
        }
        else
        {
            transform.GetChild(2).GetChild(1).GetComponent <Image>().color = GetColor(ChoiceColor(button));
            rightButtonSelected = button;
            rightPaint          = ChoiceColor(button);

            leftPaint = ChoiceColor(15);
            transform.GetChild(2).GetChild(0).GetComponent <Image>().color = GetColor(ChoiceColor(15));
            leftButtonSelected = 15;
        }
    }
Esempio n. 4
0
    private Color GetColor(PaintColors i)
    {
        switch (i)
        {
        case PaintColors.blue:
            return(new Color(0, 0.686f, 0.85f));

        case PaintColors.orange:
            return(new Color(1, 0.709f, 0.078f));

        case PaintColors.pink:
            return(new Color(1, 0.68f, 0.8f));

        case PaintColors.green:
            return(new Color(0, 0.69f, 0.24f));

        default:
            break;
        }

        return(new Color(0.701f, 0.701f, 0.701f));
    }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        PaintColors rightColor = paintWheel.GetComponent <PaintWheel>().rightPaint;


        PaintColors leftColor = paintWheel.GetComponent <PaintWheel>().leftPaint;

        switch (rightColor)
        {
        case PaintColors.red:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.cyan:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.blue:
            rightGun = Bala[2];
            break;

        case PaintColors.yellow:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.orange:
            rightGun = Bala[4];
            break;

        case PaintColors.pink:
            rightGun = Bala[5];
            break;

        case PaintColors.darkBlue:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.green:
            rightGun = Bala[3];
            break;

        default:
            rightGun = Bala[5];
            break;
        }
        switch (leftColor)
        {
        case PaintColors.red:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.cyan:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.blue:
            leftGun = Bala[2];
            break;

        case PaintColors.yellow:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.orange:
            leftGun = Bala[4];
            break;

        case PaintColors.pink:
            leftGun = Bala[5];
            break;

        case PaintColors.darkBlue:
            Debug.Log("no hay arma de este color");
            break;

        case PaintColors.green:
            leftGun = Bala[3];
            break;

        default:
            leftGun = Bala[5];
            break;
        }



        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - shotPoint.position;

        difference.Normalize();


        if (GetComponentInParent <PlayerMovement>().facingDirection == -1)
        {
            GetComponentInChildren <SpriteRenderer>().flipY = true;
            shotPoint = shotPoint2;
            light1.SetActive(false);
            light2.SetActive(true);
        }
        else if (GetComponentInParent <PlayerMovement>().facingDirection == 1)
        {
            GetComponentInChildren <SpriteRenderer>().flipY = false;
            shotPoint = shotPoint1;
            light1.SetActive(true);
            light2.SetActive(false);
        }

        if (paintWheel.GetComponent <PaintWheel>().shootable)
        {
            //left mouse button
            if (Input.GetMouseButtonDown(0))
            {
                if (audioManager != null)
                {
                    audioManager.Play("PlayerAtack");
                }


                //GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                //bulletLeft.GetComponent<Rigidbody2D>().velocity = shotPoint.TransformDirection(new Vector3(0, 0, 4));
                //GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                //bulletLeft.GetComponent<Rigidbody2D>().velocity = difference * bulletStrenght;
                if (leftGun == Bala[5])
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                }
                else if (leftGun == Bala[0] && manaManager.GetComponent <StainManager>().manaMana >= DPSMana)
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, DPSMana);
                }
                else if (leftGun == Bala[1] && manaManager.GetComponent <StainManager>().manaMana >= HealMana)
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, HealMana);
                }
                else if (leftGun == Bala[2] && manaManager.GetComponent <StainManager>().manaMana >= PortalMana)
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, PortalMana);
                }
                else if (leftGun == Bala[3] && manaManager.GetComponent <StainManager>().manaMana >= JumpBullet)
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, JumpBullet);
                }
                else if (leftGun == Bala[4] && manaManager.GetComponent <StainManager>().manaMana >= TimeBullet)
                {
                    GameObject bulletLeft = Instantiate(leftGun, shotPoint.position, shotPoint.rotation);
                    bulletLeft.GetComponent <Rigidbody2D>().velocity = bulletLeft.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, TimeBullet);
                }
            }


            //right mouse button
            if (Input.GetMouseButtonDown(1))
            {
                if (audioManager != null)
                {
                    audioManager.Play("PlayerAtack");
                }
                //GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                //bulletRight.GetComponent<Rigidbody2D>().velocity = difference * bulletStrenght;

                if (rightGun == Bala[5])
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                }
                else if (rightGun == Bala[0] && manaManager.GetComponent <StainManager>().manaMana >= DPSMana)
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, DPSMana);
                }
                else if (rightGun == Bala[1] && manaManager.GetComponent <StainManager>().manaMana >= HealMana)
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, HealMana);
                }
                else if (rightGun == Bala[2] && manaManager.GetComponent <StainManager>().manaMana >= PortalMana)
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, PortalMana);
                }
                else if (rightGun == Bala[3] && manaManager.GetComponent <StainManager>().manaMana >= JumpBullet)
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, JumpBullet);
                }
                else if (rightGun == Bala[4] && manaManager.GetComponent <StainManager>().manaMana >= TimeBullet)
                {
                    GameObject bulletRight = Instantiate(rightGun, shotPoint.position, shotPoint.rotation);
                    bulletRight.GetComponent <Rigidbody2D>().velocity = bulletRight.GetComponent <Rigidbody2D>().transform.right * -1 * bulletStrenght;
                    manaManager.GetComponent <StainManager>().manaCalculator(false, TimeBullet);
                }
            }
        }
    }
Esempio n. 6
0
 public Panel(Point coord)
 {
     coordinates = coord;
     painted     = false;
     Color       = PaintColors.Black;
 }
Esempio n. 7
0
 public Panel(Point coord, bool paint)
 {
     coordinates = coord;
     painted     = paint;
     Color       = PaintColors.Black;
 }
Esempio n. 8
0
 public Panel(Point coord, bool paint, int color)
 {
     coordinates = coord;
     painted     = paint;
     Color       = (PaintColors)color;
 }