Ejemplo n.º 1
0
    void MakeResource()
    {
        int rand = Random.Range(1 + (int)Type, 3 + (int)Type);

        if (SceneManager.GetActiveScene().name == "Stage0" && GameManager.Inst().Tutorials.Step == 1)
        {
            rand = 1;
        }
        if (Type == EnemyType.BOSS)
        {
            rand = Random.Range(5, 8);
        }

        for (int i = 0; i < rand; i++)
        {
            GameObject res = GameManager.Inst().ObjManager.MakeObj("Resource");
            if (res == null)
            {
                return;
            }

            Item_Resource resource = res.GetComponent <Item_Resource>();
            resource.transform.position = transform.position;

            Vector3 pos = transform.position;
            pos.x += Mathf.Cos(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;
            pos.y += Mathf.Sin(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;

            resource.SetValue(Random.Range(1, 3 + (int)Type));
            resource.SetColor();
            resource.TargetPosition = pos;
            resource.IsScatter      = true;
            resource.InvokeDisappear();

            if (SceneManager.GetActiveScene().name == "Stage0" && GameManager.Inst().Tutorials.Step == 1)
            {
                GameManager.Inst().UiManager.MainUI.Tutorial.SetResource(resource.gameObject);
            }
        }
    }
Ejemplo n.º 2
0
    public void Make()
    {
        GameObject explosion = GameManager.Inst().ObjManager.MakeObj("Explosion");

        explosion.transform.position = Bubble.transform.position;

        switch (Type)
        {
        case 0:
            for (int i = 0; i < 10; i++)
            {
                Item_Coin coin = GameManager.Inst().ObjManager.MakeObj("Coin").GetComponent <Item_Coin>();
                coin.SetValue(100);
                coin.transform.position = Bubble.transform.position;

                Vector3 pos = transform.position;
                pos.x += Mathf.Cos(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;
                pos.y += Mathf.Sin(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;

                coin.SetTargetPosition(pos);
                coin.SetIsScatter(true);
                coin.SetIsAbsorb(false);
            }
            break;

        case 1:
            for (int i = 0; i < 2; i++)
            {
                Item_Jewel jewel = GameManager.Inst().ObjManager.MakeObj("Jewel").GetComponent <Item_Jewel>();
                jewel.SetValue(1);
                jewel.transform.position = Bubble.transform.position;

                Vector3 pos = transform.position;
                pos.x += Mathf.Cos(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;
                pos.y += Mathf.Sin(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;

                jewel.SetTargetPosition(pos);
                jewel.SetIsScatter(true);
                jewel.SetIsAbsorb(false);
            }
            break;

        case 2:
            for (int i = 0; i < 5; i++)
            {
                Item_Resource resource = GameManager.Inst().ObjManager.MakeObj("Resource").GetComponent <Item_Resource>();
                resource.transform.position = transform.position;

                Vector3 pos = transform.position;
                pos.x += Mathf.Cos(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;
                pos.y += Mathf.Sin(Mathf.Deg2Rad * Random.Range(0.0f, 180.0f)) * 1.0f;

                resource.SetValue(10);
                resource.SetColor(DetailType);
                resource.TargetPosition = pos;
                resource.IsScatter      = true;
                resource.BeginAbsorb();
            }
            break;

        case 3:
            GameManager.Inst().MakeReinforce(DetailType, 0, Bubble.transform);
            break;
        }
    }