private int GetEndPlanetPoints(ContractPointsSettings settings, Client client) { //if (client.endPlanet != null) //{ // List<GridTile_Planet> allPlanets = PlanetManager.instance.AllPlanetTiles; // List<int> distances = new List<int>(); // int count = 0; // foreach (var planet in allPlanets) // { // distances.Add(planet.DistanceRating); // count++; // } // distances.Sort(); // int index = distances.IndexOf(client.endPlanet.DistanceRating); // int third = (count / 3) + 1; // int twoThirds = ((count / 3) * 2) + 1; // if (index <= third) // return settings.startShortDistancePoints; // else if (index > twoThirds) // return settings.startLongDistancePoints; //} //return settings.startMediumDistancePoints; return(0); }
private int GetChallengePoints(ContractPointsSettings settings, Client client) { if (client.challengeType == ChallengeType.Coords) { return(settings.CoordsChallengePoints); } else if (client.challengeType == ChallengeType.PlanetName) { return(settings.PlanetNameChallengePoints); } return(0); }
public void CalculatePointsReward(ContractPointsSettings settings) { foreach (var client in _allClients) { pointsReward += 10; //pointsReward += GetChallengePoints(settings, client); //Debug.Log("Challenge points : " + GetChallengePoints(settings, client)); //pointsReward += GetStartPlanetPoints(settings, client); //Debug.Log("Start planet points : " + GetStartPlanetPoints(settings, client)); //pointsReward += GetEndPlanetPoints(settings, client); //Debug.Log("End planet points : " + GetEndPlanetPoints(settings, client)); //pointsReward += GetDistanceTravelledPoints(settings, client); //Debug.Log("DistanceTravelled points : " + GetDistanceTravelledPoints(settings, client)); } rewardsText.text = pointsReward + "M"; }
private int GetDistanceTravelledPoints(ContractPointsSettings settings, Client client) { int nodeCount = 0; if (client.endPlanet != null) { List <PathNode> pathToTravel = PathFinder.instance.FindPath( client.endPlanet.tileX, client.endPlanet.tileY, client.startPlanet.tileX, client.startPlanet.tileY, true); if (pathToTravel != null) { nodeCount = pathToTravel.Count; } } else { nodeCount = Mathf.RoundToInt(GridCoords.CurrentGridInfo.gameGridSize.x / 1.5f); } return(Mathf.RoundToInt(nodeCount * settings.pointsPerTile)); }