示例#1
0
    //Used to remove the oueline from the highlighted piece
    void removeOutline(PieceObject tempPiece, string tempString)
    {
        var tempSet = tempPiece.getActualObjects();

        removePiece(tempPiece);
        //allPieces.Remove(tempPiece);
        createPiece(getVector3Set(tempPiece.getActualObjects()), false, tempString);
    }
示例#2
0
    void removePieceFromWallZ(PieceObject tempPiece, int zVal)
    {
        var        tempList = tempPiece.getActualObjects();
        var        currNode = tempList.First;
        GameObject currObject;

        //bool tempBool;
        //tempBool = false;
        Debug.Log(tempList.Count);

        while (currNode != null)
        {
            Debug.Log("recursion tick2");
            //Debug.Log("one Node");
            currObject = currNode.Value;
            currNode   = currNode.Next;
            //Debug.Log(currNode);

            if (currObject.transform.position.y <= sizeDim + yOffset - 4 && currObject.transform.position.z == zVal)
            {
                Debug.Log("gameobject is part of wall and not above");
                //Debug.Log("0 y value");
                tempPiece.removeObjectFromActualObjects(currObject);
                Destroy(currObject);
            }
        }
    }
示例#3
0
    //Confusing Name; Takes in a piece that is intersecting a floor, edits it so that everything on that floor is removed and everything else is moved down according to gravity
    void removePieceFromFloor(PieceObject tempPiece, int floorVal)
    {
        var        tempList = tempPiece.getActualObjects();
        var        currNode = tempList.First;
        GameObject currObject;

        //Debug.Log(tempList.Count);
        while (currNode != null)
        {
            //Debug.Log("one Node");
            currObject = currNode.Value;
            currNode   = currNode.Next;
            //Debug.Log(currNode);
            if (currObject.transform.position.y == floorVal)
            {
                //Debug.Log("0 y value");
                tempPiece.removeObjectFromActualObjects(currObject);
                Destroy(currObject);
            }
            else
            {
                if (currObject.transform.position.y > floorVal)
                {
                    currObject.transform.Translate(new Vector3(0, -1, 0), Space.World);
                }
            }
        }
    }
示例#4
0
    void reflectionUpdate()
    {
        if (currentPiece == null || currentPiece.reflectionObjects == null)
        {
            return;
        }
        var currActualList     = currentPiece.getActualObjects();
        var currReflectionNode = currentPiece.reflectionObjects.First;
        var currActualNode     = currActualList.First;

        GameObject currReflectionValue;
        GameObject currActualValue;

        //Debug.Log(tempList.Count);
        while (currReflectionNode != null)
        {
            currReflectionValue = currReflectionNode.Value;
            currActualValue     = currActualNode.Value;
            //Debug.Log("recursion tick");
            //removePiece(currNode.Value);
            //Destroy(currValue);
            currReflectionValue.transform.position = currActualValue.transform.position;

            currReflectionNode = currReflectionNode.Next;
            currActualNode     = currActualNode.Next;
        }

        reflectionGravityCheck();
    }
示例#5
0
    //Used everywhere to take in a piece object and add it to the boolean arrays and piece object arrays
    void addBlockPositions(PieceObject tempObject)
    {
        var tempSet = tempObject.getActualObjects();

        foreach (var element in tempSet)
        {
            actualField[(int)Mathf.Round(element.transform.position.x), (int)Mathf.Round(element.transform.position.y), (int)Mathf.Round(element.transform.position.z)] = tempObject;
            boolField[(int)Mathf.Round(element.transform.position.x), (int)Mathf.Round(element.transform.position.y), (int)Mathf.Round(element.transform.position.z)]   = true;
        }
    }
示例#6
0
 //Takes in a piece object and completely removes from exists (including gameobjects and arrays etc)
 void removePiece(PieceObject tempPiece)
 {
     currentPieces -= 1;
     allPieces.Remove(tempPiece);
     removeBlockPositions(tempPiece);
     foreach (var tempObject in tempPiece.getActualObjects())
     {
         Destroy(tempObject);
     }
 }