private void InitializeVariables()
 {
     score         = new Bettr_Encryption.Encrypt(0);
     Score_Encrypt = "0";
     Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);
     ShowScore();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     Physics2D.gravity           = new Vector2(0, -9.81f);
     Application.targetFrameRate = 60;
     SCORE         = new Bettr_Encryption.Encrypt(0);
     Score_Encrypt = "0";
     Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);
 }
    private void IncreaseScore(int amount)
    {
        score        += new Bettr_Encryption.Encrypt(amount);
        Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);
        Score_Encrypt = (int.Parse(Score_Encrypt) + amount).ToString();

        Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);

        ShowScore();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        Physics2D.gravity           = new Vector2(0, -9.81f);
        Application.targetFrameRate = 60;

        Anim = GetComponent <Animation>();

        position = transform.position;



        score         = new Bettr_Encryption.Encrypt(0);
        SCORE_ENCRYPT = "0";
        SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);
    }
Exemplo n.º 5
0
        public bool Load(string filename)
        {
            ScriptResource scriptResource = Global.ResourceMgr.CreateScriptResource(filename, ePath.Data);
            bool           result         = false;

            byte[] bytes = XOREncryption.Decrypt(scriptResource.TexObject.bytes, encryptKey);
            using (Stream stream = new MemoryStream(bytes))
            {
                BinaryDecoder decoder = new BinaryDecoder(stream);
                result = ReadData(decoder);
            }

            Global.ResourceMgr.DestoryResource(scriptResource);

            return(result);
        }
Exemplo n.º 6
0
    public void Start()
    {
        Physics2D.gravity           = new Vector2(0, -9.81f);
        Application.targetFrameRate = 60;
        score         = new Bettr_Encryption.Encrypt(0);
        Score_Encrypt = "0";
        Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);



        for (int foundationPileIndex = 0; foundationPileIndex < 4; foundationPileIndex++)
        {
            CreateFoundationPile();
        }


        Create(2);
    }
    private void Start()
    {
        SpawnScript.gameObject.SetActive(false);

        Physics2D.gravity           = new Vector2(0, -40f);
        Application.targetFrameRate = 60;

        //BG spritechange
        BgChange.GetComponent <SpriteRenderer>().sprite = bgSPrite[Random.Range(0, bgSPrite.Length - 1)];


        score         = new Bettr_Encryption.Encrypt(0);
        Score_Encrypt = "0";
        Score_Encrypt = XOREncryption.encryptDecrypt(Score_Encrypt);



        LevelInformation();
    }
Exemplo n.º 8
0
    void Start()
    {
        if (tag == "TAG_5")
        {
            int index = Random.Range(5, transform.childCount);

            for (int i = index; i < transform.childCount; i++)
            {
                Destroy(transform.GetChild(i).gameObject);
            }
        }

        GameController_30.instance.KNIVES_HIT = "0";
        GameController_30.instance.KNIVES_HIT = XOREncryption.encryptDecrypt(GameController_30.instance.KNIVES_HIT);
        GetComponent <AudioSource>().PlayOneShot(startClip);
        GameController_30.instance.KnifesToHit = new Bettr_Encryption.Encrypt(health);
        GameController_30.instance.KNIVES_HIT  = XOREncryption.encryptDecrypt(GameController_30.instance.KNIVES_HIT);
        GameController_30.instance.KNIVES_HIT  = (int.Parse(GameController_30.instance.KNIVES_HIT) + health).ToString();
        GameController_30.instance.KNIVES_HIT  = XOREncryption.encryptDecrypt(GameController_30.instance.KNIVES_HIT);
    }
    void LevelInformation()
    {
        if (Levels == 0)
        {
            //lives will be 4
            lives = new Bettr_Encryption.Encrypt(4);
            LIVES = "4";
            LIVES = XOREncryption.encryptDecrypt(LIVES);
        }
        else if (Levels == 1)
        {
            //lives will be 3

            lives = new Bettr_Encryption.Encrypt(3);
            LIVES = "3";
            LIVES = XOREncryption.encryptDecrypt(LIVES);
        }
        else if (Levels == 2)
        {
            //lives will be 3
            lives = new Bettr_Encryption.Encrypt(3);
            LIVES = "3";
            LIVES = XOREncryption.encryptDecrypt(LIVES);
        }
        else if (Levels == 3)
        {
            //lives will be 3
            lives = new Bettr_Encryption.Encrypt(3);
            LIVES = "3";
            LIVES = XOREncryption.encryptDecrypt(LIVES);
        }
        else if (Levels == 4)
        {
            //lives will be 2
            lives = new Bettr_Encryption.Encrypt(2);
            LIVES = "2";
            LIVES = XOREncryption.encryptDecrypt(LIVES);
        }
    }
Exemplo n.º 10
0
        /// <summary>
        ///     Read a file with decryption constants
        /// </summary>
        /// <param name="file"></param>
        /// <param name="game"></param>
        /// <param name="compressedSize"></param>
        /// <param name="size"></param>
        /// <param name="flags"></param>
        /// <param name="truth"></param>
        /// <param name="multiplier"></param>
        /// <param name="divisor"></param>
        /// <returns></returns>
        public static Span <byte> Read(Span <byte> file, string game, uint compressedSize, uint size, IDTableFlags flags, byte[] truth, ulong multiplier, ulong divisor)
        {
            if (compressedSize > file.Length)
            {
                Logger.Warn("PKGINFO", "Compressed Size is larger than actual file! The package info might have drifted from the saved files. Please verify game data!");
            }

            if (game == "VenusVacation" && file.IsKnown())
            {
                return(file);
            }

            if (flags.HasFlag(IDTableFlags.Encrypted) && (game != "VenusVacation" || flags.HasFlag(IDTableFlags.Compressed)))
            {
                var key = XOREncryption.Xor(size, truth, multiplier, divisor);
                file = XOREncryption.Crypt(file, key);
            }

            // ReSharper disable once InvertIf
            if (flags.HasFlag(IDTableFlags.Compressed) && file[4] == 0x78)
            {
                try
                {
                    var decompressedData = Stream8000Compression.Decompress(file, new CompressionOptions {
                        Length = size
                    });
                    if (decompressedData.Length != 0)
                    {
                        file = decompressedData;
                    }
                }
                catch (Exception e)
                {
                    Logger.Error("PKGINFO", e);
                }
            }

            return(file);
        }
Exemplo n.º 11
0
    // Update is called once per frame



    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform.CompareTag("TAG_0"))
        {
            Physics2D.IgnoreCollision(transform.GetComponent <CircleCollider2D>(), collision.transform.GetComponent <CircleCollider2D>());
        }
        if (collision.transform.CompareTag("TAG_3"))
        {
            Physics2D.IgnoreCollision(transform.GetComponent <CircleCollider2D>(), collision.transform.GetComponent <CircleCollider2D>());
        }



        if (collision.transform.tag == "TAG_3" && transform == SM.BodyParts[0])
        {
            GameController_25.instance.SFX.PlayOneShot(GameController_25.instance.Clip, 1f);
            //Add a body part, will be changed to the amount of body parts it has to add
            for (int i = 0; i < collision.transform.GetComponent <FoodBehavior_25>().foodAmount; i++)
            {
                SM.AddBodyPart();
            }

            //Destroy the food
            Destroy(collision.transform.gameObject);
        }



        //Also need to check if this is the first snake part
        if (collision.transform.tag == "TAG_1" && transform == SM.BodyParts[0])
        {
            //poweron
            if (SM.PowerOn)
            {
                //Stop the Particles
                SM.SnakeParticle.Stop();

                //Move the Particle system to the collision position
                SM.SnakeParticle.transform.position = collision.contacts[0].point;

                //Play the particles
                SM.SnakeParticle.Play();


                //Add one to the Score
                GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(collision.transform.GetComponent <AutoDestroy_25>().life);
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
                GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + collision.transform.GetComponent <AutoDestroy_25>().life).ToString();
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

                //Diminish the text of the box
                collision.transform.GetComponent <AutoDestroy_25>().life = 0;
            }


            //Reset the parent of the text Mesh
            if (SM.BodyParts.Count > 1 && SM.BodyParts[1] != null)
            {
                SM.PartsAmountTextMesh.transform.parent   = SM.BodyParts[1];
                SM.PartsAmountTextMesh.transform.position = SM.BodyParts[1].position +
                                                            new Vector3(0, 0.5f, 0);
            }
            else if (SM.BodyParts.Count == 1)
            {
                SM.PartsAmountTextMesh.transform.parent = null;
            }

            //Stop the Particles
            SM.SnakeParticle.Stop();

            //Move the Particle system to the collision position
            SM.SnakeParticle.transform.position = collision.contacts[0].point;

            //Play the particles
            SM.SnakeParticle.Play();

            //Destroy the Part of the snake that hit the box
            if (!SM.PowerOn)
            {
                Destroy(this.gameObject);
            }

            //Add one to the Score
            GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(1);
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
            GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + 1).ToString();
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

            //Diminish the text of the box
            collision.transform.GetComponent <AutoDestroy_25>().life -= 1;
            collision.transform.GetComponent <AutoDestroy_25>().UpdateText();

            //change its box color
            collision.transform.GetComponent <AutoDestroy_25>().SetBoxColor();

            //Remove it from the body parts list to avoid errors

            if (!SM.PowerOn)
            {
                SM.BodyParts.Remove(SM.BodyParts[0]);
            }

            SM.Collide = true;
        }


        else if (collision.transform.tag == "TAG_5" && transform == SM.BodyParts[0])
        {
            //poweron

            if (SM.PowerOn)
            {
                //Stop the Particles
                SM.SnakeParticle.Stop();

                //Move the Particle system to the collision position
                SM.SnakeParticle.transform.position = collision.contacts[0].point;

                //Play the particles
                SM.SnakeParticle.Play();


                //Add one to the Score
                GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(collision.transform.GetComponent <AutoDestroy_25>().life);
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
                GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + collision.transform.GetComponent <AutoDestroy_25>().life).ToString();
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

                //Diminish the text of the box
                collision.transform.GetComponent <AutoDestroy_25>().life = 0;
            }

            //Stop the Particles
            SM.SnakeParticle.Stop();

            //Move the Particle system to the collision position
            SM.SnakeParticle.transform.position = collision.contacts[0].point;

            //Play the particles
            SM.SnakeParticle.Play();

            // Reset the parent of the text Mesh
            if (SM.BodyParts.Count > 1 && SM.BodyParts[1] != null)
            {
                SM.PartsAmountTextMesh.transform.parent   = SM.BodyParts[1];
                SM.PartsAmountTextMesh.transform.position = SM.BodyParts[1].position +
                                                            new Vector3(0, 0.5f, 0);
            }
            else if (SM.BodyParts.Count == 1)
            {
                SM.PartsAmountTextMesh.transform.parent = null;
            }
            //Destroy the Part of the snake that hit the box
            if (!SM.PowerOn)
            {
                Destroy(this.gameObject);
            }

            //Add one to the Score
            GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(1);
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
            GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + 1).ToString();
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

            //Diminish the text of the box
            collision.transform.GetComponent <AutoDestroy_25>().life -= 1;
            collision.transform.GetComponent <AutoDestroy_25>().UpdateText();

            //change its box color
            collision.transform.GetComponent <AutoDestroy_25>().SetBoxColor();

            //Remove it from the body parts list to avoid errors
            if (!SM.PowerOn)
            {
                SM.BodyParts.Remove(SM.BodyParts[0]);
            }
            SM.Collide = true;
        }
        else if (collision.transform.tag == "TAG_6" && transform == SM.BodyParts[0])
        {
            //poweron
            if (SM.PowerOn)
            {
                //Stop the Particles
                SM.SnakeParticle.Stop();

                //Move the Particle system to the collision position
                SM.SnakeParticle.transform.position = collision.contacts[0].point;

                //Play the particles
                SM.SnakeParticle.Play();


                //Add one to the Score
                GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(collision.transform.GetComponent <AutoDestroy_25>().life);
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
                GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + collision.transform.GetComponent <AutoDestroy_25>().life).ToString();
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
                //Diminish the text of the box
                collision.transform.GetComponent <AutoDestroy_25>().life = 0;
            }

            //Reset the parent of the text Mesh
            if (SM.BodyParts.Count > 1 && SM.BodyParts[1] != null)
            {
                SM.PartsAmountTextMesh.transform.parent   = SM.BodyParts[1];
                SM.PartsAmountTextMesh.transform.position = SM.BodyParts[1].position +
                                                            new Vector3(0, 0.5f, 0);
            }
            else if (SM.BodyParts.Count == 1)
            {
                SM.PartsAmountTextMesh.transform.parent = null;
            }

            //Stop the Particles
            SM.SnakeParticle.Stop();

            //Move the Particle system to the collision position
            SM.SnakeParticle.transform.position = collision.contacts[0].point;

            //Play the particles
            SM.SnakeParticle.Play();

            //Destroy the Part of the snake that hit the box
            if (!SM.PowerOn)
            {
                Destroy(this.gameObject);
            }

            //Add one to the Score
            GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(1);
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
            GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + 1).ToString();
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
            //Diminish the text of the box
            collision.transform.GetComponent <AutoDestroy_25>().life -= 1;
            collision.transform.GetComponent <AutoDestroy_25>().UpdateText();

            //change its box color
            collision.transform.GetComponent <AutoDestroy_25>().SetBoxColor();

            //Remove it from the body parts list to avoid errors
            if (!SM.PowerOn)
            {
                SM.BodyParts.Remove(SM.BodyParts[0]);
            }

            if (collision.transform.GetComponent <AutoDestroy_25>().life == 0 && SM.BodyParts.Count > 0)
            {
                SM.PowerOn = true;
            }

            SM.Collide = true;
        }
        else if (collision.transform.tag == "TAG_8" && transform == SM.BodyParts[0])
        {
            //poweron
            if (SM.PowerOn)
            {
                //Stop the Particles
                SM.SnakeParticle.Stop();

                //Move the Particle system to the collision position
                SM.SnakeParticle.transform.position = collision.contacts[0].point;

                //Play the particles
                SM.SnakeParticle.Play();


                //Add one to the Score
                GameController_25.instance.SCORE += new Bettr_Encryption.Encrypt(collision.transform.GetComponent <AutoDestroy_25>().life);

                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
                GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + collision.transform.GetComponent <AutoDestroy_25>().life).ToString();
                GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

                //Diminish the text of the box
                collision.transform.GetComponent <AutoDestroy_25>().life = 0;
            }

            //Reset the parent of the text Mesh
            if (SM.BodyParts.Count > 1 && SM.BodyParts[1] != null)
            {
                SM.PartsAmountTextMesh.transform.parent   = SM.BodyParts[1];
                SM.PartsAmountTextMesh.transform.position = SM.BodyParts[1].position +
                                                            new Vector3(0, 0.5f, 0);
            }
            else if (SM.BodyParts.Count == 1)
            {
                SM.PartsAmountTextMesh.transform.parent = null;
            }

            //Stop the Particles
            SM.SnakeParticle.Stop();

            //Move the Particle system to the collision position
            SM.SnakeParticle.transform.position = collision.contacts[0].point;

            //Play the particles
            SM.SnakeParticle.Play();

            //Destroy the Part of the snake that hit the box
            if (!SM.PowerOn)
            {
                Destroy(this.gameObject);
            }

            //Add one to the Score
            GameController_25.instance.SCORE        += new Bettr_Encryption.Encrypt(1);
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);
            GameController_25.instance.Score_Encrypt = (int.Parse(GameController_25.instance.Score_Encrypt) + 1).ToString();
            GameController_25.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_25.instance.Score_Encrypt);

            //Diminish the text of the box
            collision.transform.GetComponent <AutoDestroy_25>().life -= 1;
            collision.transform.GetComponent <AutoDestroy_25>().UpdateText();

            //change its box color
            collision.transform.GetComponent <AutoDestroy_25>().SetBoxColor();

            //Remove it from the body parts list to avoid errors
            if (!SM.PowerOn)
            {
                SM.BodyParts.Remove(SM.BodyParts[0]);
            }

            if (collision.transform.GetComponent <AutoDestroy_25>().life == 0 && SM.BodyParts.Count > 0)
            {
                SM.MagnetOn = true;
            }


            SM.Collide = true;
        }
    }
Exemplo n.º 12
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.CompareTag("TAG_2"))
        {
            GameController_30.instance.KnifeSpawned = true;
            Destroy(gameObject);
        }


        if (scriptEnabled)
        {
            if (collider.gameObject.tag == "TAG_1" || collider.gameObject.tag == "TAG_5")
            {
                GameController_30.instance.hit++;;

                // Stop knife moving, rotate with Trunk and play hit sound
                moving           = false;
                transform.parent = collider.transform;
                GetComponent <PolygonCollider2D>().enabled = false;
                knifeRigid.bodyType = RigidbodyType2D.Kinematic;

                transform.GetChild(0).GetComponent <BoxCollider2D>().enabled = true;

                GetComponent <AudioSource>().PlayOneShot(hitSound);
                GameController_30.instance.KnifeSpawned = true;


                collider.GetComponent <Animator>().SetTrigger("Hit");
                collider.GetComponent <TrunkHealth_30>().Damage(1);

                Instantiate(particle, transform.position + transform.up * 0.25f, Quaternion.identity);
                if (GameController_30.instance.PowerMode)
                {
                    GameController_30.instance.score        += new Bettr_Encryption.Encrypt(10 * (GameController_30.instance.power + 2));
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                    GameController_30.instance.Score_Encrypt = (int.Parse(GameController_30.instance.Score_Encrypt) + 10 * GameController_30.instance.power + 1).ToString();
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                }
                else
                {
                    GameController_30.instance.score        += new Bettr_Encryption.Encrypt(10);
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                    GameController_30.instance.Score_Encrypt = (int.Parse(GameController_30.instance.Score_Encrypt) + 10).ToString();
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                }


                scriptEnabled = false;
                GetComponent <Knife_30>().enabled = false;
            }



            else
            {
                if (collider.tag == "TAG_3")
                {
                    GameController_30.instance.hit++;;

                    moving = true;
                    Destroy(collider.gameObject);
                    GameObject FruitCut = Instantiate(CutFruit, collider.transform.position, Quaternion.identity);


                    GameController_30.instance.score        += new Bettr_Encryption.Encrypt(10);
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                    GameController_30.instance.Score_Encrypt = (int.Parse(GameController_30.instance.Score_Encrypt) + 10).ToString();
                    GameController_30.instance.Score_Encrypt = XOREncryption.encryptDecrypt(GameController_30.instance.Score_Encrypt);
                    Destroy(FruitCut, 1f);
                }

                else
                {
                    GameObject.FindObjectOfType <ImageEffect_30>().ApplyEffect();
                    GameController_30.instance.hit = 0;
                    // If hit to another knives
                    moving = false;
                    knifeRigid.bodyType = RigidbodyType2D.Dynamic;
                    GetComponent <AudioSource>().PlayOneShot(fail, 1f);

                    knifeRigid.AddTorque(500f);

                    scriptEnabled = false;
                    GetComponent <Knife_30>().enabled = false;


                    GameController_30.instance.lives = new Bettr_Encryption.Encrypt(int.Parse(GameController_30.instance.lives.ToString()) - 1);
                    GameController_30.instance.LIVES = XOREncryption.encryptDecrypt(GameController_30.instance.LIVES);
                    GameController_30.instance.LIVES = (int.Parse(GameController_30.instance.LIVES) - 1).ToString();
                    GameController_30.instance.LIVES = XOREncryption.encryptDecrypt(GameController_30.instance.LIVES);
                }
            }
        }
    }
Exemplo n.º 13
0
    IEnumerator ClearCube()
    {
        yield return(new WaitForEndOfFrame());


        if (CubeList[0].gameObject.transform.childCount > 3)
        {
            bonus++;

            if (bonus > 1)
            {
                score += new Bettr_Encryption.Encrypt(bonus * 5);

                SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);
                SCORE_ENCRYPT = (int.Parse(SCORE_ENCRYPT) + bonus * 5).ToString();
                SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);
                BonusText.gameObject.SetActive(true);
                BonusText.text = bonus.ToString() + "X";
                //bloom of combo

                switch (bonus)
                {
                case 2:
                    //bonus sound
                    SFX.PlayOneShot(SFXCLIPS[4]);
                    fmb.threshold      = 0.68f;
                    fmb.intensity      = 2f;
                    fmb.blurSize       = 2.58f;
                    fmb.blurIterations = 4;

                    break;

                case 3:
                    SFX.PlayOneShot(SFXCLIPS[5]);
                    fmb.threshold      = 0.68f;
                    fmb.intensity      = 2f;
                    fmb.blurSize       = 2.58f;
                    fmb.blurIterations = 4;
                    break;

                case 4:
                    SFX.PlayOneShot(SFXCLIPS[6]);
                    fmb.threshold      = 0.68f;
                    fmb.intensity      = 3f;
                    fmb.blurSize       = 2.58f;
                    fmb.blurIterations = 4;
                    break;

                case 5:
                    SFX.PlayOneShot(SFXCLIPS[7]);
                    fmb.threshold      = 0.68f;
                    fmb.intensity      = 4f;
                    fmb.blurSize       = 2.58f;
                    fmb.blurIterations = 4;
                    break;

                case 6:
                    SFX.PlayOneShot(SFXCLIPS[8]);
                    fmb.threshold      = 0.68f;
                    fmb.intensity      = 5f;
                    fmb.blurSize       = 2.58f;
                    fmb.blurIterations = 4;
                    break;
                }
            }
            else
            {
                BonusText.gameObject.SetActive(false);
            }

            foreach (Transform t in CubeList[0].gameObject.transform)
            {
                if (CubeList[0].gameObject.tag == "TAG_3")
                {
                    //score Encryption
                    score        += new Bettr_Encryption.Encrypt(10);
                    SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);
                    SCORE_ENCRYPT = (int.Parse(SCORE_ENCRYPT) + 10).ToString();
                    SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);


                    if (bonus > 1)
                    {
                        foreach (ParticleSystem ps in BonusPS)
                        {
                            Instantiate(ps, t.transform.position, Quaternion.identity, particle.transform);
                        }
                    }
                    else if (bonus == 1)
                    {
                        //brick break sound
                        SFX.PlayOneShot(SFXCLIPS[3], 0.3f);
                        Instantiate(PS, t.transform.position, Quaternion.identity, particle.transform);
                    }
                    upwardForce = 0.2f;
                }
                else
                {
                    if (bonus > 1)
                    {
                        foreach (ParticleSystem ps in BonusPS)
                        {
                            Instantiate(ps, t.transform.position, Quaternion.identity, particle.transform);
                        }
                    }
                    else
                    {
                        SFX.PlayOneShot(SFXCLIPS[3], 0.3f);
                        Instantiate(PS, t.transform.position, Quaternion.identity, particle.transform);
                        //bloom on normal destroy
                        fmb.threshold      = 0.38f;
                        fmb.intensity      = 1f;
                        fmb.blurSize       = 2.18f;
                        fmb.blurIterations = 1;
                    }

                    //score Encryption
                    score        += new Bettr_Encryption.Encrypt(5);
                    SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);
                    SCORE_ENCRYPT = (int.Parse(SCORE_ENCRYPT) + 5).ToString();
                    SCORE_ENCRYPT = XOREncryption.encryptDecrypt(SCORE_ENCRYPT);

                    upwardForce = 0.2f;
                }
            }


            if (CubeList[0].transform.position.y < -2)
            {
                upwardForce *= 4;
            }
            else
            {
                upwardForce *= 1;
            }


            Destroy(CubeList[0].gameObject);
            CubeList.Remove(CubeList[0]);

            position.y        += upwardForce;
            transform.position = position;

            yield return(new WaitForSeconds(0.1f));

            Destroy(particle.transform.GetChild(0).gameObject);
            Destroy(particle.transform.GetChild(1).gameObject);
            Destroy(particle.transform.GetChild(2).gameObject);

            yield return(new WaitForSeconds(0.2f));

            bonus = 0;
        }
        StopCoroutine(ClearCube());
    }
Exemplo n.º 14
0
    // Decrease health
    public void Damage(int value)
    {
        health -= value;
        GameController_30.instance.KnifesToHit = new Bettr_Encryption.Encrypt(int.Parse(GameController_30.instance.KnifesToHit.ToString()) - value);
        GameController_30.instance.KNIVES_HIT  = XOREncryption.encryptDecrypt(GameController_30.instance.KNIVES_HIT);
        GameController_30.instance.KNIVES_HIT  = (int.Parse(GameController_30.instance.KNIVES_HIT) - value).ToString();
        GameController_30.instance.KNIVES_HIT  = XOREncryption.encryptDecrypt(GameController_30.instance.KNIVES_HIT);



        if (health == 0) // If there is no health
        {
            // Deactive Trunk collider
            GetComponent <CircleCollider2D>().enabled = false;

            // Trunk fragmentation
            // Fragmention 1
            transform.GetChild(0).GetComponent <Rigidbody>().isKinematic = false;
            //abhay
            transform.GetChild(0).GetComponent <Rigidbody>().AddForce(400, 900, 0);



            transform.GetChild(0).GetComponent <Rigidbody>().AddTorque(100, 100, 100);
            transform.GetChild(0).gameObject.AddComponent <BoxCollider>();
            transform.GetChild(0).parent = null;
            // Fragmention 2
            transform.GetChild(0).GetComponent <Rigidbody>().isKinematic = false;


            //abhay
            transform.GetChild(0).GetComponent <Rigidbody>().AddForce(-400, 900, 0);

            transform.GetChild(0).GetComponent <Rigidbody>().AddTorque(-100, 100, 100);
            transform.GetChild(0).gameObject.AddComponent <BoxCollider>();
            transform.GetChild(0).parent = null;
            // Fragmention 3
            transform.GetChild(0).GetComponent <Rigidbody>().isKinematic = false;
            //abhay
            transform.GetChild(0).GetComponent <Rigidbody>().AddForce(0, 900, 0);
            transform.GetChild(0).GetComponent <Rigidbody>().AddTorque(-200, 100, -100);
            transform.GetChild(0).gameObject.AddComponent <BoxCollider>();
            transform.GetChild(0).parent = null;

            while (transform.childCount > 0)
            {
                // Knives apart from Trunk
                if (transform.GetChild(0).GetComponent <Rigidbody2D>() != null)
                {
                    transform.GetChild(0).GetComponent <Rigidbody2D>().isKinematic = false;

                    transform.GetChild(0).GetComponent <Rigidbody2D>().AddForce(new Vector2(Random.Range(-400f, 400f), Random.Range(400f, 600f)));                                         //abhay
                    transform.GetChild(0).GetComponent <Rigidbody2D>().AddTorque(Random.Range(-400, 400));
                    //abhay
                    transform.GetChild(0).GetComponent <Rigidbody2D>().gravityScale = 1.5f;
                }
                //abhay
                if (transform.GetChild(0).GetComponentInChildren <BoxCollider2D>() != null)
                {
                    Destroy(transform.GetChild(0).GetComponentInChildren <BoxCollider2D>());
                }
                if (transform.GetChild(0).GetComponentInChildren <PolygonCollider2D>() != null)
                {
                    Destroy(transform.GetChild(0).GetComponentInChildren <PolygonCollider2D>());
                }



                transform.GetChild(0).gameObject.AddComponent <BoxCollider2D>();



                transform.GetChild(0).parent = null;
            }

            GetComponent <AudioSource>().PlayOneShot(breakClip);
            GameController_30.instance.IsLevelChanging = true;
            StartCoroutine(NextLevel());
        }
    }