private IntVector3 getBlobStartPosition(BlobData blobData) { Prism mainPrism = getBlob (mainBlobName).genPrism (); IntVector3 vec = blobData.getMoveDirectionUnitVector (); IntVector3 pos = new IntVector3 (mainPrism.x, mainPrism.y, mainPrism.z); int xOffset = blobData.offset.x; int yOffset = blobData.offset.y; if (blobData.offset.guarenteeHit) { IntVector3 moveDirection = blobData.getMoveDirectionUnitVector (); IntVector2 blobOffset = MDCollision.getCenterCollisionPoint (blobData.getMapData (), moveDirection); IntVector2 preferredPoint = new IntVector2 (xOffset, yOffset); int[,,] mainMapData = ((BlobManager)getBlob (mainBlobName)).mapData; IntVector2 mainOffset = MDCollision.getCollisionPoint (mainMapData, preferredPoint, moveDirection); xOffset = mainOffset.x - blobOffset.x; yOffset = mainOffset.y - blobOffset.y; } IntVector3 sizeVector = blobData.getSizeVector (); int nextOffset = xOffset; if (vec.x == 0) { pos.x += nextOffset; nextOffset = yOffset; } else { pos.x += vec.x * GameSettings.blobSpawnDistance * -1; if (vec.x == 1) pos.x -= sizeVector.x; if (vec.x == -1) pos.x += mainPrism.width; } if (vec.z == 0) { pos.z += nextOffset; nextOffset = yOffset; } else { pos.z += vec.z * GameSettings.blobSpawnDistance * -1; if (vec.z == 1) pos.z -= sizeVector.z; if (vec.z == -1) pos.z += mainPrism.depth; } if (vec.y == 0) { pos.y += nextOffset; } else { pos.y += vec.y * GameSettings.blobSpawnDistance * -1; if (vec.y == 1) pos.y -= sizeVector.y; if (vec.y == -1) pos.y += mainPrism.height; } return pos; }
private int getDriftFuel(BlobData blobData) { /* if the blob spawns, and misses the main platform, this is the total distance it will cover before disappearing off the other side of the map. */ BlobManager mainBlob = getBlob (mainBlobName); IntVector3 vec = blobData.getMoveDirectionUnitVector (); int fuel = GameSettings.blobSpawnDistance * 2; fuel += mainBlob.getPrism ().width * Mathf.Abs (vec.x); fuel += mainBlob.getPrism ().height * Mathf.Abs (vec.y); fuel += mainBlob.getPrism ().depth * Mathf.Abs (vec.z); return fuel; }
private void applyWaveData(BlobData blobData, WaveData waveData, int frequencyIndex) { Directions.Cardinal direction = waveData.genDirection (); if (direction != Directions.Cardinal.unknown) blobData.moveDirection = direction; float sizeMultiplier = waveData.genSizeMultiplier (frequencyIndex); IntVector3 blobSize = blobData.getSize (); blobData.setSize (blobSize * sizeMultiplier); Vector2 offsetMultiplier = waveData.genOffset (); IntVector3 mainSize = worldManager.getMainSizeVector (); IntVector2 collisionSize= MDCollision.getCollisionArraySize(blobData.getSizeVector(),blobData.getMoveDirectionUnitVector()); blobData.offset.x = (int)(collisionSize.x * offsetMultiplier.x); blobData.offset.y = (int)(collisionSize.y * offsetMultiplier.y); }