コード例 #1
0
    void OnTriggerEnter(Collider other)
    {
        if (GameManager.EnableTriggers == true && ControllerScript.getTimeControl() == false)
        {
            if (CameraEventTrigger)
            {
                if (other.tag == "Player")
                {
                    if (GameManager.Location == "Castle")
                    {
                        GameManager.CutsceneEnabled = true;
                        PlayerController.canControl = false;


                        CameraScript.setEventTrigger(true);
                        isActive = false;



                        if (GameManager.Scene == "Castle 1")
                        {
                            DisableForCutScene();
                            AnimatorScript.IdleInstance();
                            HealthScript.HideHearts();


                            StartCoroutine(PauseAndOpenTextBox("Oh ho, so you've arrived!", false, "The Masked Man"));
                            GameManager.Scene = "Castle 1";
                            //	CameraAnimator.WalkToCutscene = true;
                        }
                    }

                    if (GameManager.Location == "Field")
                    {
                        if (TriggerNumber == 3)
                        {
                            GameManager.CutsceneEnabled = true;
                            GameManager.Scene           = "Field Leafree";
                            PlayerController.canControl = false;
                            AnimatorScript.IdleInstance();
                            DisableForCutScene();

                            CameraScript.setEventTrigger(true);
                            HealthScript.HideHearts();

                            isActive = false;
                            GameManager.EventNumber = 1;
                            StartCoroutine(PauseAndOpenTextBox("Hey Devichi!", false, "Leafree"));
                        }
                    }
                }
            }
            else if (TextEventTrigger)
            {
                if (other.tag == "Player")
                {
                    if (isActive == true)
                    {
                        if (GameManager.Location == "Field")
                        {
                            //Step on Devilchu's Head
                            if (TriggerNumber == 1)
                            {
                                //Debug.Log("TEST2");
                                //if (BBoxScript.getisOpen() == false){
                                //	Debug.Log("TEST");
                                GameManager.Scene       = "Field Extra 1";
                                GameManager.EventNumber = 0;
                                BBoxScript.setLeftPictureName("Devilchu");
                                BBoxScript.Slide("AHHHH!! Why are you jumping on my head???");
                                BBoxScript.ActivateEmoticon("Devilchu", "Angry", false);
                                //}
                            }

                            if (TriggerNumber == 2)
                            {
                                //GameManager.CutsceneEnabled = true;
                                PlayerController.canControl = false;
                                //	PlayerController.vel.x = 0.0f;
                                AnimatorScript.RunningInstance(true);
                                GameManager.Scene       = "Field 2";
                                GameManager.EventNumber = 1;
                            }
                        }
                        if (GameManager.Location == "CaveCutscene")
                        {
                            if (TriggerNumber == 2)
                            {
                                PlayerController.vel.x = 0.0f;
                                GameManager.Scene      = "OntoCaveCutscene 4";
                                StartCoroutine(DelayFadeIn());
                                //	Debug.Log ("Bslkdjfklsf");
                            }
                        }



                        if (OnGroundOnly == false)
                        {
                            if (DisableOnTrigger)
                            {
                                Destroy(gameObject);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: SlashWave.cs プロジェクト: antu3199/DevichiGame
    void OnTriggerEnter(Collider other)
    {
        if (ControllerScript.getTimeControl() == false)
        {
            if (other.tag == "enemybody")
            {
                GameObject Root;

                if (other.gameObject.GetComponent <shooter>() == null)
                {
                    Root = other.gameObject.transform.parent.gameObject.transform.parent.gameObject;
                }
                else
                {
                    Root = other.gameObject;
                }



                if (Root.GetComponent <enemyHealth>().getBlinking() == false && Root.GetComponent <enemyHealth>().getDead() == false)
                {
                    if (PlayerAnimator.isAttack1ing == true)
                    {
                        Damage = 3;
                    }
                    else if (PlayerAnimator.isAttack2ing == true)
                    {
                        Damage = 1;

                        PlayerController Script = transform.root.GetComponent <PlayerController>();



                        if (PlayerAnimator.Attack2JumpCount < 3 && ControllerScript.getAttack2Bounce() == false)
                        {
                            Script.Jump();
                            PlayerAnimator.Attack2JumpCount++;
                        }
                    }
                    //Sends the damage
                    Root.SendMessage("takeDamage", Damage, SendMessageOptions.DontRequireReceiver);
                }
            }
            if (other.tag == "Devilchu")
            {
                GameManager.Scene       = "Field Extra 2";
                GameManager.EventNumber = 0;

                BBoxScript.Slide("OWWW!! HEY! That actually really hurt!!!");
                BBoxScript.setLeftPictureName("Devilchu");

                BBoxScript.ActivateEmoticon("Devilchu", "Angry", false);
            }
            if (other.tag == "Breakable")
            {
                if (other.GetComponent <BreakableGround>() != null)
                {
                    BreakableGround BGroundScript = other.GetComponent <BreakableGround>();
                    if (BGroundScript.getisAlive() == true)
                    {
                        BGroundScript.Explode();
                    }
                }
                else if (other.GetComponent <BlockCollider2>() != null)
                {
                    BreakableGroundGravity BGroundScript = other.transform.parent.gameObject.GetComponent <BreakableGroundGravity>();
                    if (BGroundScript.getisAlive() == true)
                    {
                        BGroundScript.TakeDamage();
                    }
                }
            }
        }
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log (GameManager.EventNumber);
        if (EnabledTriggers == true)
        {
            EnableTriggers = true;
        }
        else
        {
            EnableTriggers = false;
        }


        if (isFadingIn)
        {
            if (FadeIn + 0.015f < 1.0f)
            {
                FadeIn += 0.015f;
                CutsceneBlue.GetComponent <GUITexture>().color = new Color(FadeColour, FadeColour, FadeColour, FadeIn);
            }
            else
            {
                EventNumber++;
                isFadingIn = false;
            }
        }

        if (isFadingOut)
        {
            if (FadeIn - 0.015f > 0)
            {
                FadeIn -= 0.015f;
                CutsceneBlue.GetComponent <GUITexture>().color = new Color(FadeColour, FadeColour, FadeColour, FadeIn);
            }
            else
            {
                EventNumber++;
                isFadingOut = false;
                CutsceneBlue.GetComponent <GUITexture>().enabled = false;
            }
        }

        if (FadeInAndOut == true)
        {
            if (CutsceneBlue.GetComponent <GUITexture>().enabled == false)
            {
                CutsceneBlue.GetComponent <GUITexture>().enabled = true;
                FadeIn = 0.0f;
                CutsceneBlue.GetComponent <GUITexture>().color = new Color(1f, 1f, 1f, FadeIn);
                Whiten = true;
            }
            if (Whiten == true)
            {
                if (FadeIn + 0.015f < 1.0f)
                {
                    FadeIn += 0.015f;
                    CutsceneBlue.GetComponent <GUITexture>().color = new Color(1f, 1f, 1f, FadeIn);
                }
                else
                {
                    //DO SOMETHING....
                    Whiten = false;
                }
            }
            if (Whiten == false)
            {
                if (FadeIn - 0.015f > 0)
                {
                    FadeIn -= 0.015f;
                    CutsceneBlue.GetComponent <GUITexture>().color = new Color(1f, 1f, 1f, FadeIn);
                }
                else
                {
                    EventNumber++;
                    TextNumber++;
                    CutsceneBlue.GetComponent <GUITexture>().enabled = false;
                    FadeInAndOut = false;
                }
            }
        }

        if (Location == "Field")
        {
            if (Scene == "Field 1")
            {
                if (EventNumber == 0)
                {
                    if (FadeIn - 0.015f > 0)
                    {
                        FadeIn -= 0.015f;
                        CutsceneBlue.GetComponent <GUITexture>().color = new Color(1f, 1f, 1f, FadeIn);
                    }
                    else
                    {
                        CutsceneBlue.GetComponent <GUITexture>().enabled = false;
                        EventNumber++;

                        //BlackBoxScript.SpeedAble = true;
                        BBScript.setLeftPictureName("Devilchu");
                        BBScript.setRightPictureName("Devichi");
                        BBScript.Slide("...And that is why apples are factually the superior fruit!~");
                        BBScript.ActivateEmoticon("Devilchu", "Happy", false);
                    }
                }
                else if (EventNumber == 1)
                {
                }
            }
        }

        if (Location == "FieldCutscene")
        {
            if (Scene == "FieldCutscene 1")
            {
                if (EventNumber == 1)
                {
                    BBScript.Slide("Hey you!");
                    BBScript.setRightPictureName("Leafree");
                    BBScript.SwitchBoxDirection();
                    EventNumber++;
                    //TextNumber = EventNumber;
                }
                if (EventNumber == 9)
                {
                    Scene = "FieldCutscene 2";
                    MyAnimation.Play("FieldLeafree 2", 0, 0.0f);
                    EventNumber++;
                }
            }
            if (Scene == "FieldCutscene 2")
            {
                if (EventNumber == 15)
                {
                    Scene       = "FieldCutscene 3";
                    EventNumber = 0;
                    TextNumber  = 0;

                    MyAnimation.Play("FieldLeafree 3", 0, 0.0f);
                }
            }
        }
    }