Example #1
0
    void MakeCoin()
    {
        int rand = Random.Range(2 + (int)Type, 5 + (int)Type);

        if (Type == EnemyType.BOSS)
        {
            rand = Random.Range(10, 20);
        }

        for (int i = 0; i <= rand; i++)
        {
            GameObject coin = GameManager.Inst().ObjManager.MakeObj("Coin");
            coin.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;

            Item_Coin ic = coin.gameObject.GetComponent <Item_Coin>();
            ic.SetValue((int)Random.Range(Health * 0.1f, Health));
            ic.SetTargetPosition(pos);
            ic.SetIsScatter(true);
            ic.SetIsAbsorb(false);
        }
    }
Example #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;
        }
    }