Beispiel #1
0
    // void ProduceSun() {
    //     for (int i = 0; i < sunCount; ++i) {
    //         GameObject newSun = Instantiate(sun);
    //         newSun.GetComponent<SpriteRenderer>().sortingOrder = 10000;
    //         newSun.transform.position = transform.position;

    ////float dis = StageMap.GRID_WIDTH;
    //         //Vector3 offset = new Vector3(Random.Range(-dis, dis), Random.Range(-dis, dis), 0);

    //Vector3 offset = new Vector3(1, 2, 0);
    //         JumpBy jump = newSun.AddComponent<JumpBy>();
    //         jump.offset = offset;
    //jump.height = 1;//Random.Range(0.3f, 0.6f);
    //jump.time = 1;Random.Range(0.4f, 0.6f);
    //         jump.Begin();
    //     }
    // }   // void ProduceSun() {
    //     for (int i = 0; i < sunCount; ++i) {
    //         GameObject newSun = Instantiate(sun);
    //         newSun.GetComponent<SpriteRenderer>().sortingOrder = 10000;
    //         newSun.transform.position = transform.position;

    ////float dis = StageMap.GRID_WIDTH;
    //         //Vector3 offset = new Vector3(Random.Range(-dis, dis), Random.Range(-dis, dis), 0);

    //Vector3 offset = new Vector3(1, 2, 0);
    //         JumpBy jump = newSun.AddComponent<JumpBy>();
    //         jump.offset = offset;
    //jump.height = 1;//Random.Range(0.3f, 0.6f);
    //jump.time = 1;Random.Range(0.4f, 0.6f);
    //         jump.Begin();
    //     }
    // }

    void NProduceSun()
    {
        float x = grow.row;
        float y = grow.col;

        if (model.plantSunMap[(int)x, (int)y] == null)
        {
            for (int i = 0; i < sunCount; ++i)
            {
                Debug.Log("Aaa");
                newSun = Instantiate(sun);
                newSun.GetComponent <SpriteRenderer>().sortingOrder = 10000;
                newSun.transform.position = transform.position;

                model.plantSunMap[(int)x, (int)y] = newSun;

                //float dis = StageMap.GRID_WIDTH;
                //Vector3 offset = new Vector3(Random.Range(-dis, dis), Random.Range(-dis, dis), 0);

                Vector3 offset = new Vector3(
                    Random.Range(-0.2f, 0.2f),
                    Random.Range(0.0f, 0.6f),
                    0);

                JumpBy jump = newSun.AddComponent <JumpBy>();
                jump.offset = offset;
                jump.height = Random.Range(0.3f, 1.0f);
                jump.time   = 1;
                jump.Begin();
            }
        }
    }
Beispiel #2
0
    void ProduceSun()
    {
        GameObject newSun = Instantiate(sun);

        newSun.GetComponent <SpriteRenderer>().sortingOrder = 10000;
        newSun.transform.position = transform.position;

        float   dis    = StageMap.GRID_WIDTH;
        Vector3 offset = new Vector3(Random.Range(-dis, dis), Random.Range(-dis, dis), 0);
        JumpBy  jump   = newSun.AddComponent <JumpBy>();

        jump.offset = offset;
        jump.height = Random.Range(0.3f, 0.6f);
        jump.time   = Random.Range(0.4f, 0.6f);
        jump.Begin();
    }
Beispiel #3
0
    void ProduceSun()
    {
        for (int i = 0; i < sunCount; i++)
        {
            GameObject newSun = Instantiate(sun);
            newSun.GetComponent <SpriteRenderer>().sortingOrder = 10000;
            newSun.transform.position = transform.position;


            float   randomDis = Random.Range(-StageMap.GridWidth, StageMap.GridWidth);
            float   offsetX   = Mathf.Sign(randomDis) * 0.3f + randomDis;
            Vector3 offset    = new Vector3(offsetX, 0, 0);
            JumpBy  jump      = newSun.AddComponent <JumpBy>();
            jump.offset = offset;
            jump.height = Random.Range(0.3f, 0.6f);
            jump.time   = Random.Range(0.4f, 0.6f);
            jump.Begin();
        }
    }