Exemplo n.º 1
0
    public void killBaboonStuff()
    {
        GetComponent <Rigidbody2D>().isKinematic = true;
        if (PlaySounds.soundOn)
        {
            PlaySounds.Play_SmashBaboon();
        }
        anim.applyRootMotion = true;

        if (anim.GetBool("Land"))
        {
            anim.Play(death_state);
            //parentAnim.enabled = false;
        }
        else
        {
            jump = false;
            anim.Play(death_state);
            //parentAnim.enabled = false;
            //rigidbody2D.isKinematic = false;
            //parentAnim.Play("BaboonFallDown");
        }
        oblak.Play();
        //Debug.Log("Zgazeno");
        //rigidbody2D.isKinematic = false;
        //rigidbody2D.AddForce(new Vector2(0,600));
        //collider2D.enabled = false;
        //colliders[0].enabled = false;
        //colliders[1].enabled = false;
        player.GetComponent <Rigidbody2D>().velocity = new Vector2(player.maxSpeedX, 0);      // Vector2.zero;
        //player.rigidbody2D.AddForce(new Vector2(0, player.jumpForce - rigidbody2D.velocity.y*player.doubleJumpForce));
        player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 1500));
        player.GetComponent <Rigidbody2D>().drag = 0;
        player.canGlide = false;
        player.animator.Play(player.jump_State);
        StartCoroutine(destroyBabun());
    }
Exemplo n.º 2
0
    void Interakcija()
    {
        if (patrolinjo)
        {
            patrolinjo = false;
        }
        else if (flyinjo)
        {
            flyinjo = false;
        }
//		if(player.transform.position.y + 1.25f > reqHeight.position.y)
//		{
//
//		}
//		else
//		if(player.transform.position.y + 1.25f < reqHeight.position.y && player.activeShield)
        //	Debug.Log("Stiti: " + player.activeShield);
        if (player.activeShield || player.invincible || player.powerfullImpact)
        {
            if (runinjo)
            {
                runinjo = false;
            }
            reqHeight.GetComponent <KillTheBaboon>().turnOffColliders();
            if (parentRigidbody2D != null)
            {
                parentRigidbody2D.isKinematic = true;
            }

            anim.applyRootMotion = true;
            if (anim.GetBool("Land"))
            {
                anim.Play(death_state);
                //parentAnim.enabled = false;
            }
            else
            {
                //jump = false;
                anim.Play(deathJump_state);
                Invoke("UgasiBabunaPoslePada", 1f);
            }
            oblak.Play();
            //collider2D.enabled = false;
            colliders[0].enabled = false;
            colliders[1].enabled = false;
            //colliders[2].enabled = false;
            player.GetComponent <Rigidbody2D>().velocity = new Vector2(player.maxSpeedX, 0);
            //player.rigidbody2D.AddForce(new Vector2(0, player.jumpForce - rigidbody2D.velocity.y*player.doubleJumpForce));
            if (player.activeShield)
            {
                if (PlaySounds.soundOn)
                {
                    PlaySounds.Play_LooseShield();
                }
                player.activeShield = false;
                player.transform.Find("Particles/ShieldDestroyParticle").GetComponent <ParticleSystem>().Play();
                player.transform.Find("Particles/ShieldDestroyParticle").GetChild(0).GetComponent <ParticleSystem>().Play();
                GameObject.Find("_GameManager").SendMessage("ApplyPowerUp", -3);
                if (player.state != MonkeyController2D.State.running)
                {
                    //player.rigidbody2D.AddForce(new Vector2(0, 1500));
                    player.GetComponent <Rigidbody2D>().drag = 0;
                    player.canGlide = false;
                    player.animator.Play(player.jump_State);
                }
            }
            else if (!player.isSliding)
            {
                if (player.state != MonkeyController2D.State.running)
                {
                    player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 1500));
                }
            }

            StartCoroutine(destroyBabun());
        }
        else if (!player.killed)
        {
            if (PlaySounds.soundOn)
            {
                PlaySounds.Play_SmashBaboon();
            }
            //anim.applyRootMotion = true;
            player.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            player.killed = true;

            //if(runinjo)
            //	runinjo = false;
            if (run)
            {
                run          = false;
                runTurnedOff = true;
            }

            //collider2D.enabled = false;
            reqHeight.GetComponent <KillTheBaboon>().turnOffColliders();

            //collider2D.enabled = false;
            //if(!jump)
            //	parentAnim.enabled = false;

            colliders[0].enabled = false;
            colliders[1].enabled = false;
            //colliders[2].enabled = false;
            if (anim.GetBool("Land"))
            {
                if (!run)
                {
                    anim.Play(strike_state);
                    if (parentRigidbody2D != null)
                    {
                        parentRigidbody2D.isKinematic = true;
                    }

                    maxSpeedX = 0;
                }
            }
            else
            {
                Invoke("UkljuciCollidereOpet", 0.35f);
                //parentAnim.enabled = true;
            }
            oblak.Play();
            //collider2D.enabled = false;
            //colliders[0].enabled = false;
            //colliders[1].enabled = false;
            //transform.localScale = new Vector3(-transform.localScale.x,transform.localScale.y,transform.localScale.z);
            //Debug.Log("Utepan");
            if (player.state == MonkeyController2D.State.running)
            {
                player.majmunUtepan();
            }
            else
            {
                player.majmunUtepanULetu();
            }

            kontrolaZaBrzinuY = true;
            //smanjivac = parentRigidbody2D.velocity.y;
            //Invoke("resetujKontroluZaBrzinu",1.5f);
        }
    }
Exemplo n.º 3
0
    IEnumerator destroyBabun()
    {
        if (isGorilla)
        {
            Manage.gorillasKilled++;
            MissionManager.Instance.GorillaEvent(Manage.gorillasKilled);
            kolicinaPoena = 40;
            if (fly)
            {
                Manage.fly_GorillasKilled++;
                MissionManager.Instance.Fly_GorillaEvent(Manage.fly_GorillasKilled);
                kolicinaPoena = 60;
            }
            else if (koplje)
            {
                Manage.koplje_GorillasKilled++;
                MissionManager.Instance.Koplje_GorillaEvent(Manage.koplje_GorillasKilled);
                kolicinaPoena = 70;
                Koplje.GetComponent <Collider2D>().enabled = false;
            }
            else if (jump)
            {
                kolicinaPoena = 50;
            }
            else if (patrol)
            {
                kolicinaPoena = 40;
            }
            else if (run)
            {
                kolicinaPoena = 70;
            }
            else if (runAndJump)
            {
                kolicinaPoena = 80;
            }
        }
        else
        {
            Manage.baboonsKilled++;
            MissionManager.Instance.BaboonEvent(Manage.baboonsKilled);
            kolicinaPoena = 40;
            if (fly)
            {
                Manage.fly_BaboonsKilled++;
                MissionManager.Instance.Fly_BaboonEvent(Manage.fly_BaboonsKilled);
                kolicinaPoena = 60;
            }
            else if (boomerang)
            {
                Manage.boomerang_BaboonsKilled++;
                MissionManager.Instance.Boomerang_BaboonEvent(Manage.boomerang_BaboonsKilled);
                kolicinaPoena = 70;
                //Boomerang.collider2D.enabled = false;
                Boomerang.SetActive(false);
            }
            else if (jump)
            {
                kolicinaPoena = 50;
            }
            else if (patrol)
            {
                kolicinaPoena = 40;
            }
            else if (run)
            {
                kolicinaPoena = 70;
            }
            else if (runAndJump)
            {
                kolicinaPoena = 80;
            }
        }
        //manage.baboonSmashed++; // ZA FINALNU VERZIJU
        //manage.AddPoints(150); // ZA FINALNU VERZIJU
        if (fly || run)
        {
            senka.GetComponent <Renderer>().enabled = false;
        }

        if (PlaySounds.soundOn)
        {
            PlaySounds.Play_SmashBaboon();
        }

        int value = 3;

        if (jump)
        {
            value = 4;
        }
        else if (fly)
        {
            value = 4;
        }
        else if (patrol)
        {
            value = 3;
        }
        else if (run)
        {
            value = 4;
        }
        else if (runAndJump)
        {
            value = 5;
        }
        else if (boomerang || koplje)
        {
            value = 6;
        }

        Transform ThreeCoinsHolder = transform.parent.Find("+3CoinsHolder");

        ThreeCoinsHolder.Find("+3Coins").GetComponent <TextMesh>().text = ThreeCoinsHolder.Find("+3Coins/+3CoinsShadow").GetComponent <TextMesh>().text = "+" + value;
        ThreeCoinsHolder.parent = transform.parent.parent;         //OVDE IZBACIO NULL REFERENCE EXCEPTION
        //"U RED IZNAD IZBACIO NULL REFERENCE ZA JUMP GORILLU, A DRUGI PUT SAM GA UBIO SLIDE-OM ALI JE I MAJMUNCE POGINUO, VEROVATNO ZATO STO JE OSTAO ONAJ 3 COLLIDER VISKA U PREFAB-U, TREBA DA SE PROVERI!!!!!"
        //"ZA +3COINS JE SVUDA MISSING SPRITE, ILI DA SE UBACI NOVI ILI DA SE ZAMENI FONTOM, PA DA MU SE DAJE NA RANDOM OD 3 DO 6 NOVCICA RECIMO, S TIM STO TREBA DA SE PROVERI DA LI CE RADITI ANIMACIJA ZA FONT!!!!!"
        ThreeCoinsHolder.GetComponent <Animator>().Play("FadeOutCoins");
        Manage.coinsCollected += value;
        //StagesParser.currentMoney+=3;
        MissionManager.Instance.CoinEvent(Manage.coinsCollected);
        coinsCollectedText.text = Manage.coinsCollected.ToString();
        coinsCollectedText.GetComponent <TextMeshEffects>().RefreshTextOutline(false, true);
        Manage.points         += kolicinaPoena;
        Manage.pointsText.text = Manage.points.ToString();
        Manage.pointsEffects.RefreshTextOutline(false, true);
        yield return(new WaitForSeconds(1.2f));

        transform.parent.parent.Find("+3CoinsHolder").parent = transform.parent;

        //Destroy(this.gameObject);

//		if(MonkeyController2D.canRespawnThings)
//		{
//			//transform.parent.gameObject.SetActive(false);
//			//this.enabled = false;
//			anim.enabled = false;
//			colliders[0].enabled = true;
//			colliders[1].enabled = true;
//			//collider2D.enabled = true;
//			//parentAnim.enabled = true;

        //	@@@@@@ ZASTO JE OVO BILO UKLJUCENO ISPOD?
        //	reqHeight.GetComponent<KillTheBaboon>().turnOnColliders();

//			transform.localPosition = baboonLocPos;
//		}
    }
Exemplo n.º 4
0
    void Interakcija()
    {
//		if(player.transform.position.y + 1.25f > reqHeight.position.y)
//		{
//
//		}
//		else
//		if(player.transform.position.y + 1.25f < reqHeight.position.y && player.activeShield)
        //	Debug.Log("Stiti: " + player.activeShield);
        if (player.activeShield)
        {
            Debug.Log("Stitulj");
            reqHeight.GetComponent <KillTheBaboon>().turnOffColliders();
            GetComponent <Rigidbody2D>().isKinematic = true;
            if (PlaySounds.soundOn)
            {
                PlaySounds.Play_SmashBaboon();
            }

            anim.applyRootMotion = true;
            if (anim.GetBool("Land"))
            {
                anim.Play(death_state);
                //parentAnim.enabled = false;
            }
            else
            {
                jump = false;
                anim.Play(death_state);
            }
            oblak.Play();
            //collider2D.enabled = false;
            colliders[0].enabled = false;
            colliders[1].enabled = false;
            player.GetComponent <Rigidbody2D>().velocity = new Vector2(player.maxSpeedX, 0);;
            //player.rigidbody2D.AddForce(new Vector2(0, player.jumpForce - rigidbody2D.velocity.y*player.doubleJumpForce));
            if (player.activeShield)
            {
                player.activeShield = false;
                GameObject.Find("_GameManager").SendMessage("ApplyPowerUp", -3);
                if (player.state != MonkeyController2D.State.running)
                {
                    player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 1500));
                    player.GetComponent <Rigidbody2D>().drag = 0;
                    player.canGlide = false;
                    player.animator.Play(player.jump_State);
                }
            }
            else
            {
                player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 1500));
            }

            StartCoroutine(destroyBabun());
        }
        else if (!player.killed)
        {
            Debug.Log("nema stitulj");
            if (PlaySounds.soundOn)
            {
                PlaySounds.Play_SmashBaboon();
            }
            //anim.applyRootMotion = true;
            player.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            player.killed = true;
            maxSpeedX     = 0;
            run           = false;
            //collider2D.enabled = false;
            //reqHeight.GetComponent<KillTheBaboon>().turnOffColliders();
            //colliders[0].enabled = false;
            //colliders[1].enabled = false;
            //if(!jump)
            //	parentAnim.enabled = false;
            GetComponent <Rigidbody2D>().isKinematic = true;
            if (anim.GetBool("Land"))
            {
                anim.Play(strike_state);
            }
            else
            {
                //parentAnim.enabled = true;
            }
            oblak.Play();
            //collider2D.enabled = false;
            //colliders[0].enabled = false;
            //colliders[1].enabled = false;
            //transform.localScale = new Vector3(-transform.localScale.x,transform.localScale.y,transform.localScale.z);
            //Debug.Log("Utepan");
            if (player.state == MonkeyController2D.State.running)
            {
                player.majmunUtepan();
            }
            else
            {
                player.majmunUtepanULetu();
            }
        }
    }