Exemplo n.º 1
0
    void Update()
    {
        if (GD.GetComponent <Director>().gameMode != Director.MODE.PLAY)
        {
            return;
        }
        switch (ctype)
        {
        case CalotteType.FLEE:
            if (Input.GetMouseButton(0))
            {
                if (KeepFlg)
                {
                    ClickTime += Time.deltaTime;
                    if (sndCnt == 0)
                    {
                        Sound.GetComponent <SoundsManager>().Mandragora(0, 0);
                        sndCnt = 1;
                    }
                    if (ClickTime >= ClickMaxTime)
                    {
                        SetParent();
                        GetComponent <SpriteRenderer>().sprite = Mand[0];
                        if (sndCnt == 1)
                        {
                            Sound.GetComponent <SoundsManager>().Mandragora(2, sndCnt);
                            sndCnt = 2;
                        }
                        else if (sndCnt == 2)
                        {
                            Sound.GetComponent <SoundsManager>().Mandragora(2, sndCnt);
                            sndCnt = 2;
                        }
                        this.GetComponent <HarvestEffect>().EffectPlay();
                        ctype = CalotteType.KEEP;
                    }
                }
            }
            break;

        case CalotteType.KEEP:      //揺れる
            if (Input.GetMouseButtonUp(0))
            {
                ctype = CalotteType.RESET;
            }
            break;

        case CalotteType.RESET:      //揺れる
            NoneParent();
            ctype = CalotteType.FALL;
            gameObject.transform.eulerAngles = new Vector3(0, 0, 0);
            break;

        case CalotteType.FALL:
            switch (fallStatus)
            {
            case FallStatus.FALL:
                GetComponent <SpriteRenderer>().sprite = Mand[0];
                if (this.gameObject.transform.position.x >= 0)
                {
                    AnimeFlg = true;
                }
                else
                {
                    AnimeFlg = false;
                }
                if (LatencyTime <= LatencyMaxTime)
                {
                    LatencyTime += Time.deltaTime;
                    this.gameObject.transform.position -= new Vector3(0, MoveSpeed, 0);
                }
                else
                {
                    fallStatus  = FallStatus.OROORO;
                    LatencyTime = 0.0f;
                }
                break;

            case FallStatus.OROORO:
                Flight_Anime();
                if (LatencyTime <= OroOroTime)
                {
                    LatencyTime += Time.deltaTime;
                }
                else
                {
                    fallStatus  = FallStatus.FLIGHT;
                    LatencyTime = 0.0f;
                }
                break;

            case FallStatus.FLIGHT:
                Flight_Anime();
                if (this.gameObject.transform.position.x >= 0)
                {
                    this.gameObject.transform.position += new Vector3(FlightSpeed, 0.0f, 0.0f);
                }
                else
                {
                    this.gameObject.transform.position -= new Vector3(FlightSpeed, 0.0f, 0.0f);
                }
                if (gameObject.transform.position.x >= 4.0f || gameObject.transform.position.x <= -4.0f ||
                    gameObject.transform.position.y >= 6.0f || gameObject.transform.position.y <= -5.5f)
                {
                    GameObject go = GameObject.FindGameObjectWithTag("Spawn");
                    go.GetComponent <MandGeneretor>().MandGene(gameObject.transform.name);
                    Destroy(gameObject);
                }
                break;
            }
            break;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        switch (ctype)
        {
        case CalotteType.FLEE:
            if (Input.GetMouseButton(0))
            {
                if (KeepFlg)
                {
                    ClickTime += Time.deltaTime;
                    if (ClickTime >= ClickMaxTime)
                    {
                        SetParent();
                        ctype = CalotteType.KEEP;
                    }
                }
            }
            break;

        case CalotteType.KEEP:      //揺れる

            if (Input.GetMouseButtonUp(0))
            {
                ctype = CalotteType.RESET;
            }
            break;

        case CalotteType.RESET:      //揺れる
            NoneParent();
            ctype = CalotteType.FALL;
            break;

        case CalotteType.FALL:
            switch (fallStatus)
            {
            case FallStatus.FALL:
                if (LatencyTime <= LatencyMaxTime)
                {
                    LatencyTime += Time.deltaTime;
                    this.gameObject.transform.position -= new Vector3(0, MoveSpeed, 0);
                }
                else
                {
                    fallStatus  = FallStatus.OROORO;
                    LatencyTime = 0.0f;
                }
                break;

            case FallStatus.OROORO:
                if (LatencyTime <= OroOroTime)
                {
                    LatencyTime += Time.deltaTime;
                }
                else
                {
                    fallStatus  = FallStatus.FLIGHT;
                    LatencyTime = 0.0f;
                }
                break;

            case FallStatus.FLIGHT:
                if (this.gameObject.transform.position.x >= 0)
                {
                    this.gameObject.transform.position += new Vector3(FlightSpeed, 0.0f, 0.0f);
                }
                else
                {
                    this.gameObject.transform.position -= new Vector3(FlightSpeed, 0.0f, 0.0f);
                }
                if (!GetComponent <SpriteRenderer>().isVisible)
                {
                    Destroy(this.gameObject);
                }
                break;
            }

            break;
        }
    }