Ejemplo n.º 1
0
 public override void Setup(ObjectiveBase newObjective)
 {
     base.Setup(newObjective);
     blueGemObjective = objective.GetComponent <BlueGemObjective>();
     EventManager.StartListening("BlueGemsChanged", updateListener);
     UpdateView();
 }
Ejemplo n.º 2
0
 public virtual void Setup(ObjectiveBase newObjective)
 {
     objective      = newObjective;
     updateListener = new UnityAction(Refresh);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the given fitnesses together.
        /// </summary>
        public static TFitness Add <TProblem, TSolution, TFitness>(this ObjectiveBase <TProblem, TSolution, TFitness> objective, TProblem problem, TFitness fitness1, TFitness fitness2, TFitness fitness3)
        {
            var fitness = objective.Add(problem, fitness1, fitness2);

            return(objective.Add(problem, fitness, fitness3));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns true if fitness1 is better than the fitness2.
 /// </summary>
 public static bool IsBetterThan <TProblem, TSolution, TFitness>(this ObjectiveBase <TProblem, TSolution, TFitness> objective, TProblem problem, TFitness fitness1, TFitness fitness2)
 {
     return(objective.CompareTo(problem, fitness1, fitness2) < 0);
 }
Ejemplo n.º 5
0
        private static Objective[] SetupObjectives()
        {
            ObjectiveOuterTurret     topr = new ObjectiveOuterTurret(SummonersRift.TopLane.Red_Outer_Turret), topb = new ObjectiveOuterTurret(SummonersRift.TopLane.Blue_Outer_Turret), midr = new ObjectiveOuterTurret(SummonersRift.MidLane.Red_Outer_Turret), midb = new ObjectiveOuterTurret(SummonersRift.MidLane.Blue_Outer_Turret), botr = new ObjectiveOuterTurret(SummonersRift.BottomLane.Red_Outer_Turret), botb = new ObjectiveOuterTurret(SummonersRift.BottomLane.Blue_Outer_Turret);
            ObjectiveInnerTurret     topr2 = new ObjectiveInnerTurret(SummonersRift.TopLane.Red_Inner_Turret, topr), topb2 = new ObjectiveInnerTurret(SummonersRift.TopLane.Blue_Inner_Turret, topb), midr2 = new ObjectiveInnerTurret(SummonersRift.MidLane.Red_Inner_Turret, midr), midb2 = new ObjectiveInnerTurret(SummonersRift.MidLane.Blue_Inner_Turret, midb), botr2 = new ObjectiveInnerTurret(SummonersRift.BottomLane.Red_Inner_Turret, botr), botb2 = new ObjectiveInnerTurret(SummonersRift.BottomLane.Blue_Inner_Turret, botb);
            ObjectiveInhibitorTurret topr3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Red_Top_Turret, topr2), topb3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Blue_Top_Turret, topb2), midr3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Red_Mid_Turret, midr2), midb3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Blue_Mid_Turret, midb2), botr3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Red_Bottom_Turret, botr2), botb3 = new ObjectiveInhibitorTurret(SummonersRift.Base.Blue_Bottom_Turret, botb2);
            ObjectiveInhibitor       topr4 = new ObjectiveInhibitor(SummonersRift.Base.Red_Top_Inhibitor, topr3), topb4 = new ObjectiveInhibitor(SummonersRift.Base.Blue_Top_Inhibitor, topb3), midr4 = new ObjectiveInhibitor(SummonersRift.Base.Red_Mid_Inhibitor, midr3), midb4 = new ObjectiveInhibitor(SummonersRift.Base.Blue_Mid_Inhibitor, midb3), botr4 = new ObjectiveInhibitor(SummonersRift.Base.Red_Bottom_Inhibitor, botr3), botb4 = new ObjectiveInhibitor(SummonersRift.Base.Blue_Bottom_Inhibitor, botb3);
            ObjectiveBaseTurret      topr5 = new ObjectiveBaseTurret(SummonersRift.Base.Red_Top_Nexus_Turret, topr4, midr4, botr4), topb5 = new ObjectiveBaseTurret(SummonersRift.Base.Blue_Top_Nexus_Turret, topb4, midb4, botb4), botr5 = new ObjectiveBaseTurret(SummonersRift.Base.Red_Bottom_Nexus_Turret, topr4, midr4, botr4), botb5 = new ObjectiveBaseTurret(SummonersRift.Base.Blue_Bottom_Nexus_Turret, topb4, midb4, botb4);
            ObjectiveBase            midr6 = new ObjectiveBase(SummonersRift.Base.Red_Nexus, topr5, botr5), midb6 = new ObjectiveBase(SummonersRift.Base.Blue_Nexus, topb5, botb5);
            ObjectiveDragon          drag  = new ObjectiveDragon(SummonersRift.River.Dragon);
            ObjectiveBaron           baron = new ObjectiveBaron(SummonersRift.River.Baron);

            Objective[] objectives;
            // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
            if (ObjectManager.Player.Team == GameObjectTeam.Order)
            {
                objectives = new Objective[] { topr, midr, botr, topr2, midr2, botr2, topr3, midr3, botr3, topr4, midr4, botr4, topr5, botr5, midr6, drag, baron };
            }
            else
            {
                objectives = new Objective[] { topb, midb, botb, topb2, midb2, botb2, topb3, midb3, botb3, topb4, midb4, botb4, topb5, botb5, midb6, drag, baron };
            }

            // Using hardcoded Distance values because you can't use pathfinding from X to Y at runtime, just from player to X. And you can't use the straight distance, because jungle ...
            #region Baron
            baron.SetDistanceTo(midb, 4200);
            baron.SetDistanceTo(topb, 4500);
            baron.SetDistanceTo(botb, 10900);
            baron.SetDistanceTo(topb2, 4700);
            baron.SetDistanceTo(midb2, 4900);
            baron.SetDistanceTo(botb2, 9400);
            baron.SetDistanceTo(topb3, 6800);
            baron.SetDistanceTo(midb3, 6400);
            baron.SetDistanceTo(botb3, 9100);

            baron.SetDistanceTo(topr, 4200);
            baron.SetDistanceTo(midr, 4200);
            baron.SetDistanceTo(botr, 11400);
            baron.SetDistanceTo(topr2, 6300);
            baron.SetDistanceTo(midr2, 5400);
            baron.SetDistanceTo(botr2, 10100);
            baron.SetDistanceTo(topr3, 8100);
            baron.SetDistanceTo(midr3, 7300);
            baron.SetDistanceTo(botr3, 9700);

            baron.SetDistanceTo(drag, 7900);
            baron.OrientNonMappedOnNearestMapped(objectives);
            #endregion

            #region Dragon
            drag.SetDistanceTo(midb, 4600);
            drag.SetDistanceTo(topb, 11100);
            drag.SetDistanceTo(botb, 4200);
            drag.SetDistanceTo(topb2, 9900);
            drag.SetDistanceTo(midb2, 5400);
            drag.SetDistanceTo(botb2, 6200);
            drag.SetDistanceTo(topb3, 9500);
            drag.SetDistanceTo(midb3, 7100);
            drag.SetDistanceTo(botb3, 8200);

            drag.SetDistanceTo(topr, 11100);
            drag.SetDistanceTo(midr, 4300);
            drag.SetDistanceTo(botr, 4000);
            drag.SetDistanceTo(topr2, 9900);
            drag.SetDistanceTo(midr2, 5200);
            drag.SetDistanceTo(botr2, 4700);
            drag.SetDistanceTo(topr3, 9200);
            drag.SetDistanceTo(midr3, 6400);
            drag.SetDistanceTo(botr3, 6700);

            drag.SetDistanceTo(baron, 7900);
            drag.OrientNonMappedOnNearestMapped(objectives);
            #endregion

            foreach (var objective in objectives)
            {
                objective.TryGenerateDisplayName();
            }

            return(objectives);
        }
    public void Setup(ObjectiveBase objective)
    {
        text.text = objective.objectiveTitle;

        // TODO: show check when objective complete
    }