Vector3 LerpMovement(GhostData data) { Node target = pathFinder.GetNodeInDirection(data.getCurrentNode(), data.getDirection()); if (data.getLerpTime() > 1f) { data.setLerpTime(0f); } return(Vector3.Lerp(data.getCurrentNode().pos, target.pos, data.getLerpTime())); }
void HandleCollisions(GhostData ghost) { Node myNode = ghost.getCurrentNode(); Direction myDir = ghost.getDirection(); Node frontNode = pathFinder.GetNodeInDirection(myNode, myDir); foreach (GhostData otherGhost in ghostMap.Values) { if (otherGhost != ghost && !otherGhost.getRespawn() && (myNode == otherGhost.getCurrentNode() || frontNode == otherGhost.getCurrentNode())) { ghost.setDirection(FlipDirection(myDir)); ghost.setLerpTime(0); } } }