Esempio n. 1
0
    public int BlockDensity;     //0~10;

    // Update is called once per frame
    private void Start()
    {
        for (int x = -6; x <= 6; x++)
        {
            for (int z = -6; z <= 6; z++)
            {
                bool    presence  = (Random.Range(1, BlockDensity)) != 1;
                Vector3 pos       = new Vector3(x, 0.5f, z);
                bool    isInStage = GeneralController.IsInStage(pos);
                if (isInStage && !IsInCorner(pos) && presence)
                {
                    Instantiate(block, pos, Quaternion.identity);
                }
            }
        }
    }
Esempio n. 2
0
    private void BlazeInLine(Dictionary <string, decimal> distanceDict)
    {
        Vector3 dir = new Vector3();
        Vector3 p;

        Vector3 pos = transform.position;

        foreach (var d in explodeDistanceDict)
        {
            Debug.LogWarning(String.Format("dict key is {0} and dict value is {1}", d.Key, d.Value));
            for (int j = 1; j <= d.Value; j++)
            {
                switch (d.Key)
                {
                case "xPlus":
                    dir = new Vector3(j, 0, 0);
                    p   = pos + dir;
                    Debug.Log(String.Format("blaze is at {0}", p));
                    Debug.Log(String.Format("xplus is in stage :{0} ", GeneralController.IsInStage(p)));

                    if (GeneralController.IsInStage(p))
                    {
                        var blaze = Instantiate(ExplodeObj, p, Quaternion.identity);
                        Destroy(blaze, 1.0f);
                    }

                    break;

                case "xMinus":
                    dir = new Vector3(j, 0, 0);
                    p   = pos - dir;
                    Debug.Log(String.Format("blaze is at {0}", p));
                    Debug.Log(String.Format("xminus is in stage :{0} ", GeneralController.IsInStage(p)));
                    if (GeneralController.IsInStage(p))
                    {
                        var blaze = Instantiate(ExplodeObj, p, Quaternion.identity);
                        Destroy(blaze, 1.0f);
                    }

                    break;

                case "zPlus":
                    dir = new Vector3(0, 0, j);
                    p   = pos + dir;
                    Debug.Log(String.Format("blaze is at: {0}", p));
                    Debug.Log(String.Format("zplus is in stage :{0} ", GeneralController.IsInStage(p)));

                    if (GeneralController.IsInStage(p))
                    {
                        var blaze = Instantiate(ExplodeObj, p, Quaternion.identity);
                        Destroy(blaze, 1.0f);
                    }

                    break;

                case "zMinus":
                    dir = new Vector3(0, 0, j);
                    p   = pos - dir;
                    Debug.Log(String.Format("blaze is at: {0}", p));
                    Debug.Log(String.Format("zminus is in stage :{0} ", GeneralController.IsInStage(p)));
                    if (GeneralController.IsInStage(p))
                    {
                        var blaze = Instantiate(ExplodeObj, p, Quaternion.identity);
                        Destroy(blaze, 1.0f);
                    }

                    break;

                default:
                    break;
                }
            }
        }
    }