Ejemplo n.º 1
0
        public static PlayerArchetype operator-(PlayerArchetype lhs, PlayerArchetype rhs)
        {
            PlayerArchetype ret = new PlayerArchetype();

            for (int idx = 0; idx < NumArchetypes; idx++)
            {
                ret.Values[idx] = lhs.Values[idx] - rhs.Values[idx];
            }

            return(ret);
        }
Ejemplo n.º 2
0
            public Plan(PlannerNode plan, Beat TargetBeat, PlayerArchetype archetype)
            {
                Archetype = archetype;

                Beats = new List <Beat>();
                while (plan != null)
                {
                    Beats.Add(plan.NodeBeat);
                    plan = plan.Parent;
                }

                //Doesn't get added during the planning process, so add it here
                Beats.Add(TargetBeat);

                CalculateScore();
            }
Ejemplo n.º 3
0
Archivo: Beat.cs Proyecto: Yann4/Thesis
        public Beat(List <WorldPropertyScriptable> preconditions, PlayerArchetype archetype, float importance, int maxRepititons,
                    List <Action> requiredActions, List <Action> optionalActions, string title)
        {
            UID = UnityEditor.GUID.Generate().GetHashCode();

            ScriptablePreconditions = preconditions;
            Archetype = archetype;

            Importance     = importance;
            MaxRepetitions = maxRepititons;

            RequiredActions = requiredActions;
            OptionalActions = optionalActions;

            Title = title;

            CalculatePostconditions();
        }
Ejemplo n.º 4
0
Archivo: Beat.cs Proyecto: Yann4/Thesis
        public int CompareTo(Beat other)
        {
            PlayerArchetype playerArchetype = App.WorldState.Archetype;
            float           thisAffinity    = Archetype * playerArchetype;
            float           otherAffinity   = other.Archetype * playerArchetype;

            if (thisAffinity == otherAffinity)
            {
                if (Importance == other.Importance)
                {
                    return(RepetitionsPerformed.CompareTo(other.RepetitionsPerformed));
                }

                return(Importance.CompareTo(other.Importance));
            }

            return(thisAffinity.CompareTo(otherAffinity));
        }
Ejemplo n.º 5
0
Archivo: Beat.cs Proyecto: Yann4/Thesis
        private void DeserialiseVersion1(BinaryReader reader)
        {
            int preconditionCount = reader.ReadInt32();

            for (int idx = 0; idx < preconditionCount; idx++)
            {
                ScriptablePreconditions.Add(WorldPropertyScriptable.Deserialise(reader));
                if (ScriptablePreconditions[idx] != null)
                {
                    Preconditions.Add(ScriptablePreconditions[idx].GetRuntimeProperty());
                }
            }

            Archetype = new PlayerArchetype(reader);

            Importance = reader.ReadSingle();
            Order      = reader.ReadInt32();

            MaxRepetitions       = reader.ReadInt32();
            RepetitionsPerformed = reader.ReadInt32();

            int requiredActionCount = reader.ReadInt32();

            for (int idx = 0; idx < requiredActionCount; idx++)
            {
                RequiredActions.Add(Action.Deserialise(reader));
            }

            int optionalActionCount = reader.ReadInt32();

            for (int idx = 0; idx < optionalActionCount; idx++)
            {
                OptionalActions.Add(Action.Deserialise(reader));
            }

            Title = reader.ReadString();

            Generated = reader.ReadBoolean();
        }
Ejemplo n.º 6
0
 public void ModifyPlayerArchetype(PlayerArchetype modifyBy)
 {
     Archetype += modifyBy;
 }