-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Objects can now hold more than one activity; first prototype of LotMa…
…nager collates master list of activities
- Loading branch information
1 parent
1657a4e
commit 3492300
Showing
15 changed files
with
246 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
using UnityEngine.AI; | ||
|
||
namespace CharacterModel { | ||
|
||
|
||
[System.Serializable] | ||
public class ActivityChoice : IComparer<ActivityChoice>, System.IComparable<ActivityChoice> { | ||
[SerializeField] public Activity activity; | ||
//[SerializeField] public AbstractNeedEvaluator evaluator; | ||
public float desirability = 0; // This is to be calculated during decision making, not preset as data | ||
|
||
// Getting and setting desirability | ||
public float GetDesirability(CoreNeeds needs, float situation) | ||
=> needs.GetNeed(activity.need).Evaluator.GetDesirability(this, needs.GetNeed(activity.need), situation); | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public void SetDesirability(CoreNeeds needs, float situation) { | ||
needs.GetNeed(activity.need).Evaluator.SetDesirability(this, needs.GetNeed(activity.need), situation); | ||
} | ||
|
||
// Comparisons -- desirability is the basis, since the more desirable choices willl be preferred | ||
// Compare() and CompareTo() are set up so that sort functions will place higher desirability on top | ||
public static bool operator >(ActivityChoice a, ActivityChoice b) => a.desirability > b.desirability; | ||
public static bool operator <(ActivityChoice a, ActivityChoice b) => a.desirability < b.desirability; | ||
public static bool operator >=(ActivityChoice a, ActivityChoice b) => a.desirability >= b.desirability; | ||
public static bool operator <=(ActivityChoice a, ActivityChoice b) => a.desirability <= b.desirability; | ||
public int Compare(ActivityChoice a, ActivityChoice b) { | ||
return -a.desirability.CompareTo(b.desirability); // Should I do this, or use arithmetic? | ||
} | ||
public int CompareTo(ActivityChoice other) { | ||
return -desirability.CompareTo(other.desirability); // Should I do this, or use arithmetic? | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
using UnityEngine.AI; | ||
|
||
namespace CharacterModel { | ||
|
||
|
||
[System.Serializable] | ||
public class ActivityHolder : MonoBehaviour { | ||
|
||
[SerializeField] ActivityChoice[] activities; | ||
|
||
public ActivityChoice[] Activities => activities; | ||
public ActivityChoice GetActivityChoice(int n) => activities[n]; | ||
public Activity GetActivity(int n) => activities[n].activity; | ||
|
||
|
||
public void AddActivities(ref List<ActivityChoice> mainList) { | ||
foreach(ActivityChoice activity in Activities) { | ||
mainList.Add(activity); | ||
} | ||
} | ||
|
||
|
||
// TODO: It seems I need more, but not sure what yet | ||
|
||
} | ||
|
||
|
||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using CharacterEngine; | ||
|
||
|
||
namespace CharacterModel { | ||
|
||
[System.Serializable] | ||
public class Skills { | ||
[SerializeField] Skill[] coreSkills = new Skill[17]; | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
#region SkillEnums | ||
public enum ECoreSkills { | ||
//Physical | ||
Athletics = 0, | ||
Dancing = 1, | ||
Driving = 2, | ||
MartialArts = 3, | ||
|
||
//Creative | ||
Art = 4, | ||
Music = 5, | ||
Writing = 6, | ||
|
||
//Intellectual | ||
Science = 7, | ||
Mechanical = 8, | ||
Computers = 9, | ||
Gaming = 10, | ||
|
||
//Social | ||
Charm = 11, | ||
Performance = 12, | ||
Persuasion = 13, | ||
|
||
//Practical | ||
Business = 14, | ||
Cooking = 15, | ||
Housekeeping = 16, | ||
Naturalist = 17 | ||
} | ||
|
||
|
||
public enum EChildSkills { | ||
Physical = 0, | ||
Creative = 1, | ||
Intellectual = 2, | ||
Social = 3, | ||
Practical = 4 | ||
} | ||
|
||
|
||
public enum EHiddenSkills { | ||
Physical = 0, | ||
Creative = 1, | ||
Intellectual = 2, | ||
Social = 3, | ||
Practical = 4 | ||
} | ||
#endregion | ||
|
||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
using UnityEngine.AI; | ||
|
||
namespace CharacterModel { | ||
|
||
|
||
[System.Serializable] | ||
public class LotManager : MonoBehaviour { | ||
[SerializeField] List<ActivityHolder> usableObjects; | ||
[SerializeField] List<Character> characters; | ||
|
||
private List<ActivityChoice> choices; | ||
|
||
// Start is called before the first frame update | ||
void Start() { | ||
choices = new List<ActivityChoice>(); | ||
foreach(ActivityHolder usableObject in usableObjects) { | ||
usableObject.AddActivities(ref choices); | ||
} | ||
foreach(Character character in characters) { | ||
character.AI.AssignChoices(choices); | ||
} | ||
} | ||
|
||
/*// Update is called once per frame | ||
void Update() { | ||
}*/ | ||
} | ||
|
||
} |
Oops, something went wrong.