public class ExampleQuest : Quest { // Derives from quest class // Use this for initialization void Start() { // Initialise quest questName = "Example Quest"; questDescription = "Kill enemies to complete this quest."; itemReward = ItemDatabase.instance.GiveItem(itemRewardSlug); experienceReward = 100; isFinalQuest = true; // For each kill objective for (int i = 0; i < differentEnemiesToKill__EnterSlugNameInElement.Length; i++) { //Debug.Log("Kill " + numberToKill__CorrespondingOrder[i] + " " + differentEnemiesToKill__EnterSlugNameInElement[i]); // Add new kill objective with the information given GoalList.Add(new KillQuestObjective(this, 1, "Kill " + numberToKill__CorrespondingOrder[i] + " " + differentEnemiesToKill__EnterSlugNameInElement[i], false, 0, numberToKill__CorrespondingOrder[i])); } // For each collection objective for (int j = 0; j < differentItemsToCollect__EnterSlugNameInElement.Length; j++) { // Add new collection objective with the information given GoalList.Add(new CollectionQuestObjective(this, differentItemsToCollect__EnterSlugNameInElement[j], "Find " + numberToCollect__CorrespondingOrder[j] + " " + differentItemsToCollect__EnterSlugNameInElement[j], false, 0, numberToCollect__CorrespondingOrder[j])); } // Initialise each objective in goal list GoalList.ForEach(x => x.Initialise()); }
/// <summary> /// This procedure contains the user code. Input parameters are provided as regular arguments, /// Output parameters as ref arguments. You don't have to assign output parameters, /// they will have a default value. /// </summary> private void RunScript(List <object> Goals, bool Reset, bool Step, ref object A, ref object B, ref object C, ref object D, ref object E, ref object F) { // <Custom code> if (Reset) { PS = new KangarooSolver.PhysicalSystem(); counter = 0; GoalList.Clear(); foreach (IGoal G in Goals) //Assign indexes to the particles in each Goal: { PS.AssignPIndex(G, 0.0001); // the second argument is the tolerance distance below which points combine into a single particle GoalList.Add(G); } } if (Step) { PS.SimpleStep(GoalList); counter++; } A = PS.GetOutput(GoalList); B = counter; C = PS.GetAllMoves(GoalList); D = PS.GetAllWeightings(GoalList); E = PS.GetPositionArray(); var Names = new List <String> [PS.ParticleCount()]; for (int i = 0; i < PS.ParticleCount(); i++) { Names[i] = new List <String>(); } for (int i = 0; i < GoalList.Count; i++) { var FullName = GoalList[i].ToString(); Char splitter = '.'; var Name = FullName.Split(splitter); if (Name[0] != "KangarooSolver") { Name = FullName.Split('_', '+'); } var G = GoalList[i] as IGoal; for (int j = 0; j < G.PIndex.Count(); j++) { Names[G.PIndex[j]].Add(Name[2]); } } F = Names; // </Custom code> }
/// <summary> /// This procedure contains the user code. Input parameters are provided as regular arguments, /// Output parameters as ref arguments. You don't have to assign output parameters, /// they will have a default value. /// </summary> private void RunScript(List <object> Goals, bool Reset, bool Step, ref object A, ref object B) { if (Reset) { PS = new KangarooSolver.PhysicalSystem(); counter = 0; GoalList.Clear(); foreach (IGoal G in Goals) //Assign indexes to the particles in each Goal: { PS.AssignPIndex(G, 0.0001); // the second argument is the tolerance distance below which points combine into a single particle GoalList.Add(G); } } if (Step) { PS.Step(GoalList, true, 1); counter++; } A = PS.GetOutput(GoalList); B = counter; }