示例#1
0
    // Update is called once per frame
    void Update()
    {
        // using unity getComponent system
        //score = GameObject.Find("Rick").GetComponent<RickController>().score;

        // using EzMsg / standard form (using lambda)
        score = EzMsg.Request <IScore, int?>(scoreMgr, _ => _.GetScore());

        timeUntilSpawn -= Time.deltaTime;
        if (timeUntilSpawn <= 0)
        {
            Vector3 newPos = new Vector3(1.5f, 1.5f, 0);
            Instantiate(rock, newPos, Quaternion.identity);

            if (score <= 5)
            {
                timeUntilSpawn = Random.Range(1.8f, 2.2f);
            }
            else if (score > 5 && score <= 10)
            {
                Debug.Log("oi");
                timeUntilSpawn = Random.Range(1.3f, 1.8f);
            }
            else if (score > 10 && score <= 15)
            {
                timeUntilSpawn = Random.Range(1.0f, 1.4f);
            }
            else if (score > 15)
            {
                timeUntilSpawn = Random.Range(0.5f, 1.0f);
            }
        }
    }
示例#2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Coin")
     {
         EzMsg.Send <IScoreCount>(gameObject, _ => _.ApplyScore(point))
         .Wait(0.5f)
         .Run();
         // gSceneManager.Instance.score++;
         source.PlayOneShot(coinSound, 1.0f);
         Destroy(collision.gameObject);
     }
     var pontos = EzMsg.Request <IScoreCount, float?>(gameObject, GetpointScore);
 }
示例#3
0
 public static EzMsg.SendSeqData Wait(this GameObject gO, float timeToWait, bool realtime = false, EzMsg.SendSeqData sendSeqData = null)
 {
     return(EzMsg.Wait(timeToWait, realtime, sendSeqData));
 }
示例#4
0
 /// <summary>Shorthand, auto-run extension method for EzMsg.Send(gameObject, eventAction). Eg.:
 /// col.gameObject.Send<IArmor>(_=>_.ApplyDamage(Damage));
 /// This can NOT be chained / sequenced
 /// </summary>
 /// <param name="gO">Target GameObject</param>
 /// <param name="eventAction">Method to be executed</param>
 /// <typeparam name="T">Interface Type to be matched</typeparam>
 public static void Send <T>(this GameObject gO, EzMsg.EventAction <T> eventAction,
                             bool sendToChildren = false, EzMsg.SendSeqData sendSeqData = null)
     where T : IEventSystemHandler
 {
     EzMsg.Send(gO, eventAction, sendToChildren, sendSeqData).Run();
 }
示例#5
0
 /// <summary>Shorthand extension method for EzMsg.Request(gameObject, eventFunc). Eg.:
 /// int h1 = EzMsg.Request<IArmor, int>(col.gameObject, _=>_.GetHealth());
 /// </summary>
 /// <param name="gO">Target GameObject</param>
 /// <param name="eventFunc">Method to be executed</param>
 /// <param name="sendToChildren">Should the request be sent to children of Target?</param>
 /// <typeparam name="T1">System Handler Interface Type</typeparam>
 /// <typeparam name="T2">Return type</typeparam>
 /// <returns></returns>
 public static T2 Request <T1, T2>(this GameObject gO, EzMsg.EventFunc <T1, T2> eventFunc, bool sendToChildren = true)
     where T1 : IEventSystemHandler
 {
     return(EzMsg.Request(gO, eventFunc, sendToChildren));
 }
示例#6
0
        public void OnTriggerEnter(Collider other)
        {
            //### Request an int value from a GetHealth method from any gameObject's component implementing IArmor

//      * Inline format, no previous declaration required
//	    var health = EzMsg.Request<IArmor, int>(other.gameObject, _=>_.GetHealth());

//      * Shorthand form with Predefined Request
//	    var health = EzMsg.Request(other.gameObject, GetArmorHealth);

//      * Shorthand/Extension form from gameObject
//	    var health = other.gameObject.Request(GetArmorHealth);
//
//	    Debug.Log("(Projectile) Armor Health found: " + health);

            //### Sends an ApplyDamage(Damage) message to all gameObject's components implementing IArmor

//      * Original 'ExecuteEvents' format:
//      ExecuteEvents.Execute<IArmor>(other.gameObject, null, (x,y)=>x.ApplyDamage(Damage));

//      * Inline format, no previous declaration required
//		EzMsg.Send<IArmor>(other.gameObject, _=>_.ApplyDamage(Damage)).Run();

//      * Shorthand form with Predefined Request.
//	    Generic type <> doesn' need to be defined since ApplyDamageMsg already did it.
//	    Note that this can't be chained, but auto-runs
//	    other.gameObject.Send(ApplyDamageMsg);

//	    other.gameObject.Send<IArmor>(_=>_.ApplyDamage(Damage));


//	    * Different ways to perform a Request. Use nullable primitive types (bool?, int?, etc) to check
//        if Response was obtained (result != null).
//	    int? h1 = EzMsg.Request<IArmor, int?>(other.gameObject, _=>_.GetHealth());

//	    * Please notice the shorthand form (extension to GameObject) doesn't allow chaining
//	    var h2 = other.gameObject.Request<IArmor, int?>(_=>_.GetHealth());

//      * Pre-initialized Request. In this case, we will not send the request to the children of target
//	    var h3 = other.gameObject.Request(GetArmorHealth, false);
//	    Debug.Log("Health found: "+h3+" Time: "+Time.time);

//	    bool? validTarget = EzMsg.Request<IArmor, bool?>(other.gameObject, _=>_.IsDestructible(), true);
//	    Debug.Log(validTarget == null ? "No valid target found." : "Is target valid ? "+validTarget );

//	    bool validTarget = EzMsg.Request<IArmor, bool>(other.gameObject, _=>_.IsDestructibleNonNullable(), true, true);
//	    Debug.Log("Is target valid ? "+validTarget );

//	    EzMsg.Send<IArmor>(other.gameObject, _=>_.ApplyDamage(Damage)).Run();
//	    other.gameObject.Send<IArmor>(_=>_.ApplyDamage(Damage));


            // Note: Currently, a EzMsgManager component is required in the scene for any wait-chained commands.

            EzMsg.Send <IArmor>(other.gameObject, _ => _.ApplyDamage(Damage))
            .Wait(2f)
            .Send <IWeapon>(gameObject, _ => _.Reload())
            .Run();

//      * Send's Shorthand form is non-chainable, but executes immediately..
//	    other.gameObject.Send<IArmor>(_=>_.ApplyDamage(Damage));

//	    * ..yet Wait's shorthand form is chainable. Yes, you may start with a gameObject.Wait(0f)
//	    other.gameObject.Wait(4f).Send<IWeapon>(gameObject, _=>_.Reload())
//	        .Run();
        }
示例#7
0
    void Update()
    {
        #region Score and Health Text Update

        // using EzMsg / standard form (using lambda)
        score = EzMsg.Request <IScore, int?>(scoreMgr, _ => _.GetScore());

        scoretext.text  = "SCORE: " + score;
        healthtext.text = "HP: " + health;
        #endregion

        invincible = EzMsg.Request <IInvincibility, bool>(rickMgr, _ => _.GetInvincible());

        #region Invincibility

        //if (invincible == true) {
        //    Color tmp = _rb.GetComponent<SpriteRenderer>().color;
        //    tmp.a = 0.5f;
        //    _rb.GetComponent<SpriteRenderer>().color = tmp;
        //    timer += Time.deltaTime;
        //    seconds = (int)timer % 60;
        //    if (seconds == 3) {
        //        tmp.a = 1.0f;
        //        _rb.GetComponent<SpriteRenderer>().color = tmp;
        //        source.PlayOneShot(restore);
        //        invincible = false;
        //        timer = 0;
        //    }
        //}

        if (invincible == true)
        {
            Debug.Log("OLHA LA");
            EzMsg.Send <IInvincibility>(rickMgr, _ => _.isInvincible()).
            Wait(3f).
            Send <IInvincibility>(rickMgr, _ => _.isNotInvincible()).
            Run();
        }

        #endregion

        #region Calling Jump Method
        if ((Input.GetButton("Jump") || Input.touches.Length > 0) && _groundCheck == true)
        {
            _anim.SetBool("isjumping", true);
            DoJump();
        }
        #endregion

        #region Ground Check
        if (Input.GetKeyDown("space"))
        {
            source.PlayOneShot(jump, 0.5f);
        }

        if (_rb.transform.position.y >= 0.2)
        {
            _groundCheck = false;
        }

        if (_rb.transform.position.y <= -0.4)
        {
            _groundCheck = true;
        }

        #endregion

        #region Raycast to Score
        int layerMask = 1 << 11;

        RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up, Mathf.Infinity, layerMask);

        if (hit.collider != null)
        {
            didScore = true;
        }
        #endregion
    }
示例#8
0
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.name.Equals("Parede") == true)
        {
            Destroy(this.gameObject);
        }

        if (other.gameObject.tag == "BlackEnemy" || other.gameObject.tag == "BlueEnemy" || other.gameObject.tag == "BrownEnemy" || other.gameObject.tag == "DarkGreenEnemy" || other.gameObject.tag == "GreenEnemy" || other.gameObject.tag == "OrangeEnemy" ||
            other.gameObject.tag == "PurpleEnemy" || other.gameObject.tag == "RedEnemy" || other.gameObject.tag == "SkinEnemy" || other.gameObject.tag == "YellowEnemy" || other.gameObject.tag == "GrayEnemy" || other.gameObject.tag == "RainbowEnemy" ||
            other.gameObject.tag == "EraserEnemy" || other.gameObject.tag == "BlackXEnemy" || other.gameObject.tag == "BlueXEnemy" || other.gameObject.tag == "BrownXEnemy" || other.gameObject.tag == "DarkGreenXEnemy" || other.gameObject.tag == "GreenXEnemy" || other.gameObject.tag == "OrangeXEnemy" ||
            other.gameObject.tag == "PurpleXEnemy" || other.gameObject.tag == "RedXEnemy" || other.gameObject.tag == "SkinXEnemy" || other.gameObject.tag == "YellowXEnemy" || other.gameObject.tag == "GrayXEnemy" || other.gameObject.tag == "RainbowXEnemy")
        {
            colidi = true;
            //Debug.Log("Colidi em algo" + other.gameObject.name);
            EzMsg.Send <IColisao>(other.gameObject, _ => _.ApplyColisao(colidi)).Run();

            if (other.gameObject.tag == "BlackEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(blackInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "BlueEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(blueInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "BrownEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(brownInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "DarkGreenEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(darkGreenInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "GreenEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(greenInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "OrangeEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(orangeInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "PurpleEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(purpleInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "RedEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(redInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "SkinEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(skinInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "YellowEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(yellowInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "GrayEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(grayInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "RainbowEnemy")
            {
                Destroy(this.gameObject);
                Instantiate(rainbowInk, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);
            }
            if (other.gameObject.tag == "EraserEnemy")
            {
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "OrangeXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = orange;

                        if (col.gameObject.name == "Orange" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightOrange++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "BlackXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.black;

                        if (col.gameObject.name == "Black" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightBlack++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "BlueXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.blue;

                        if (col.gameObject.name == "Blue" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightBlue++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "BrownXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = brown;

                        if (col.gameObject.name == "Brown" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightBrown++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "DarkGreenXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = darkGreen;

                        if (col.gameObject.name == "DarkGreen" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightDarkGreen++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "GrayXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.gray;

                        if (col.gameObject.name == "Gray" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightGray++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "GreenXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.green;

                        if (col.gameObject.name == "Green" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightGreen++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "PurpleXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = purple;

                        if (col.gameObject.name == "Purple" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightPurple++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "RedXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.red;

                        if (col.gameObject.name == "Red" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightRed++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "SkinXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = skin;

                        if (col.gameObject.name == "Skin" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightSkin++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "YellowXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        col.GetComponent <Renderer>().material.color = Color.yellow;

                        if (col.gameObject.name == "Yellow" && col.GetComponent <CheckPaint>().rightColor == false)
                        {
                            col.GetComponent <CheckPaint>().rightColor = true;
                            player.GetComponent <PaintCubes>().rightCubes++;
                            player.GetComponent <PaintCubes>().rightYellow++;
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
            if (other.gameObject.tag == "RainbowXEnemy")
            {
                collidersInRange = Physics.OverlapSphere(other.gameObject.transform.position, Radius / 2);
                foreach (Collider col in collidersInRange)
                {
                    if (col.gameObject.tag == "Cube" && col.GetComponent <CheckPaint>().rightColor == false && col.gameObject.name != "Blank")
                    {
                        if (col.gameObject.name == "Gray")
                        {
                            col.GetComponent <Renderer>().material.color = Color.gray;

                            if (col.gameObject.name == "Gray" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightGray++;
                            }
                        }
                        if (col.gameObject.name == "Green")
                        {
                            col.GetComponent <Renderer>().material.color = Color.green;

                            if (col.gameObject.name == "Green" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightGreen++;
                            }
                        }
                        if (col.gameObject.name == "DarkGreen")
                        {
                            col.GetComponent <Renderer>().material.color = darkGreen;

                            if (col.gameObject.name == "DarkGreen" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightDarkGreen++;
                            }
                        }
                        if (col.gameObject.name == "Blue")
                        {
                            col.GetComponent <Renderer>().material.color = Color.blue;

                            if (col.gameObject.name == "Blue" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightBlue++;
                            }
                        }
                        if (col.gameObject.name == "Red")
                        {
                            col.GetComponent <Renderer>().material.color = Color.red;

                            if (col.gameObject.name == "Red" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightRed++;
                            }
                        }
                        if (col.gameObject.name == "Yellow")
                        {
                            col.GetComponent <Renderer>().material.color = Color.yellow;

                            if (col.gameObject.name == "Yellow" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightYellow++;
                            }
                        }
                        if (col.gameObject.name == "Skin")
                        {
                            col.GetComponent <Renderer>().material.color = skin;

                            if (col.gameObject.name == "Skin" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightSkin++;
                            }
                        }
                        if (col.gameObject.name == "Purple")
                        {
                            col.GetComponent <Renderer>().material.color = purple;

                            if (col.gameObject.name == "Purple" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightPurple++;
                            }
                        }
                        if (col.gameObject.name == "Orange")
                        {
                            col.GetComponent <Renderer>().material.color = orange;

                            if (col.gameObject.name == "Orange" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightOrange++;
                            }
                        }
                        if (col.gameObject.name == "Brown")
                        {
                            col.GetComponent <Renderer>().material.color = brown;

                            if (col.gameObject.name == "Brown" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightBrown++;
                            }
                        }
                        if (col.gameObject.name == "Black")
                        {
                            col.GetComponent <Renderer>().material.color = Color.black;

                            if (col.gameObject.name == "Black" && col.GetComponent <CheckPaint>().rightColor == false)
                            {
                                col.GetComponent <CheckPaint>().rightColor = true;
                                player.GetComponent <PaintCubes>().rightCubes++;
                                player.GetComponent <PaintCubes>().rightBlack++;
                            }
                        }
                    }
                }

                Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
        }
    }