예제 #1
0
    void SeeChunlian()
    {
        GameObject chunlian = GameObject.Find("chunlian");

        came.GetComponent <Camera>().orthographicSize = 3f;
        cmwp.changeToSolidPoint(chunlian.transform.position, true);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (ifopen)
        {
            if (name == "SceneDoor1")
            {
                if (!ifseeall)
                {
                    if (!ifshowed)
                    {
                        cmwp.changeToSolidPoint(point, false);

                        if (Came.orthographicSize <= 11.5f)
                        {
                            Came.orthographicSize += Time.deltaTime * 7;
                        }
                        came.transform.rotation = new Quaternion(0, 0, 0, 0);
                        if (Came.orthographicSize >= 11.5f)
                        {
                            ifshowed = true;
                        }
                    }

                    if (cmwp.ifMoveWithPlayer)
                    {
                        if (Came.orthographicSize >= 1.5f)
                        {
                            Came.orthographicSize -= Time.deltaTime * 7;
                        }
                        came.transform.rotation = new Quaternion(0, 0, 180, 0);
                        if (Came.orthographicSize <= 1.5f)
                        {
                            ifseeall = true;
                        }
                    }
                }
                if (ifseeall)
                {
                    GetComponent <Animator>().enabled = true;
                    if (curColor >= -0.9f)
                    {
                        curColor -= Time.deltaTime / 4;
                        cb.ma.SetFloat("_Float1", curColor);
                    }
                    Invoke("ChangeScene", 2f);
                }
            }
            else if (name == "SceneDoorPre")
            {
                GetComponent <Animator>().enabled = true;
                if (curColor >= -0.9f)
                {
                    curColor -= Time.deltaTime / 4;
                    cb.ma.SetFloat("_Float1", curColor);
                }
                Invoke("ChangeScene", 2f);
            }
        }
    }
예제 #3
0
    // Use this for initialization


    void Update()
    {
        if (iftriggered)
        {
            if (ifemerge && !ifshowed)
            {
                ScenarioEmerge();
            }
            if (iffade)
            {
                ScenarioFade();
            }
            if (name == "RotationEventPoint")
            {
                pc.ifUpSideDown = true;

                /*
                 * Destroy(GameObject.Find("NPCs"));
                 * Destroy(GameObject.Find("Monster"));
                 * Destroy(GameObject.Find("fuzi(Clone)"));
                 * Destroy(GameObject.Find("Dumplings(Clone)"));*/
                NowRotation = player.transform.localEulerAngles.z;
                if (NowRotation < 180f)
                {
                    //rotation += Time.deltaTime;
                    came.transform.Rotate(0, 0, rotatePerFrame);
                    player.transform.Rotate(0, 0, rotatePerFrame);
                }
                else if (NowRotation >= 180f && ifshowed)
                {
                    iftriggered = false;
                }
                Physics2D.gravity = new Vector3(0, 9.81F, 0);
            }
            else if (name == "SeeTheMonsterEventPoint")
            {
                GameObject.Find("CannonEventPoint").GetComponent <BoxCollider2D>().enabled = true;
            }
            else if (name == "ThrowDumplingsEventPoint")
            {
#if UNITY_ANDROID
                script = "在这里把饺子丢下去吸引它(按'■'键)";
#endif
                if (ifeventonce)
                {
                    if (ifshowed)
                    {
                        if ((Input.GetKeyDown("e") || rpu.if_E_Pressed) && !pc.facingRight)
                        {
                            Invoke("ThrowDumplings", 0.1f);
                            ifeventonce = false;
                        }
                    }
                }
            }
            else if (name == "SeeChunlianEventPoint")
            {
                if (ifeventonce)
                {
                    if (pc.grounded)
                    {
                        player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                        pc.enabled = false;
                    }
                    if (ifshowed && pc.enabled == false)
                    {
                        GameObject chunlian = GameObject.Find("chunlian");
                        came.GetComponent <Camera>().orthographicSize = 3f;
                        cmwp.changeToSolidPoint(chunlian.transform.position, true);
                        ifeventonce = false;
                        pc.enabled  = true;
                    }
                }
            }
            else if (name == "PutFuEventPoint")
            {
#if UNITY_ANDROID
                script = "把福字贴回去吧(按'■'键)";
#endif
                if (ifeventonce)
                {
                    if (ifshowed)
                    {
                        if ((Input.GetKeyDown("e") || rpu.if_E_Pressed) && pc.facingRight)
                        {
                            StartCoroutine(FuziFunc());
                            ifeventonce = false;
                        }
                    }
                }
            }
            else if (name == "SeeFireEventPoint")
            {
                if (ifeventonce)
                {
                    if (pc.grounded)
                    {
                        player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                        pc.enabled = false;
                    }
                    if (ifshowed && pc.enabled == false)
                    {
                        //player.GetComponent()

                        GameObject Fire = GameObject.Find("FireCrakerBomb");
                        cmwp.changeToSolidPoint(Fire.transform.position, true);
                        Quaternion randomRotation = Quaternion.Euler(0f, 0f, Random.Range(0f, 360f));
                        explosion.transform.localScale = new Vector3(0.15f, 0.15f, 1f);
                        StartCoroutine(rpu.Emerge(GameObject.Find("NPC1 (2)")));
                        // Instantiate the explosion where the rocket is with the random rotation.
                        Instantiate(explosion, Fire.transform.position, randomRotation);
                        ifeventonce = false;
                        pc.enabled  = true;
                    }
                }
            }
            else if (name == "InChapter1EventPoint")
            {
                GameObject.Find("GameManager").GetComponent <Manager2>().co = ChapterOrder.Chapter1;
                Destroy(this);
            }
        }
    }