示例#1
0
    bool IsNeighbourOf(ObjectManager.ObjType targetObjType, int x, int y, int z)
    {
        for (int i = -1; i <= 1; i++)
        {
            for (int j = -1; j <= 1; j++)
            {
                for (int k = -1; k <= 1; k++)
                {
                    if (y + j < 0 || y + j >= MapHeight || x + i < 0 || x + i >= MapWidth || z + k < 0 || z + k >= MapDepth)
                    {
                        continue;
                    }
                    if (i == 0 && j == 0 && k == 0)
                    {
                        continue;
                    }

                    if (ObjectManager.Instance.objArr[x + i, y + j, z + k] == targetObjType)
                    {
                        return(true);
                    }
                }
            }
        }
        return(false);
    }
示例#2
0
    //오브젝트 A 와 B 를 비율 ratio 만큼 나오도록 랜덤하게 뿌려준다.
    ObjectManager.ObjType BlendGenerate(ObjectManager.ObjType A, ObjectManager.ObjType B, float ratio)
    {
        float randomNum = Random.Range(0.0f, 1.0f);

        if (randomNum < ratio)
        {
            return(A);
        }
        else
        {
            return(B);
        }
    }
示例#3
0
 void SetObjType(ObjectManager.ObjType type)
 {
     objType = type;
 }