Example #1
0
    IEnumerator Rotate(byte rot)
    {
        Debug.Log(rot);
        var sold = Clear();

        yield return(new WaitForSeconds(0.1f));

        foreach (var shp in sold)
        {
            int     newpos  = RotateCalcNewColliderPos(0, BlockData.AssemblePos(shp.Key.x, shp.Key.y, shp.Key.z), rot);
            ColPriv newType = CollideData.GetRotation(shp.Value, rot);
            this.partType = newType;
            var pposition = new Vector3Int(BlockData.GetX(newpos), BlockData.GetY(newpos), BlockData.GetZ(newpos));
            buildonly = (ColPrivAlterations)((int)partType & ~0xFF) == ColPrivAlterations.IGNORE_FOR_COLLISION;

            ResetGhost();

            yield return(new WaitForEndOfFrame());// WaitForSeconds(.1f);

            shapes.Add(new KeyValuePair <Vector3Int, ColPriv>(pposition, partType));
            ghost.transform.position = pposition;
            GameObject g = Instantiate(ghost);
            g.GetComponent <MeshRenderer>().material = whitetrans;
            if (buildonly)
            {
                g.GetComponent <MeshRenderer>().material = lightgreen;
            }
            if (!manifest.ContainsKey(pposition))
            {
                manifest[pposition] = new List <GameObject>();
            }
            manifest[pposition].Add(g);
        }
    }
Example #2
0
 void printVariants(ColPriv colp)
 {
     Debug.Log(colp + " " + CollideData.GetRotation(colp, 0x4) + " " + CollideData.GetRotation(colp, 0x8) + " " + CollideData.GetRotation(colp, 0xC));
 }