Skip to content

Commit

Permalink
chore: update unity package to 3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
QuakeEye committed Jun 26, 2024
1 parent a25caa2 commit 776a5b9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ConnectedComponentsBeliefSet()
GetCurrentTarget = new(
reference: TargetPositionsInConnectedComponents,
getObservationFromReference: positions => positions.Peek(),
shouldUpdate: () =>
shouldUpdate: _ =>
{
if (TargetPositionsInConnectedComponents.Count == 0) return false;

Expand Down
28 changes: 14 additions & 14 deletions aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using static Aplib.Core.Combinators;
using Goal = Aplib.Core.Desire.Goals.Goal<Testing.AplibTests.GameplayBeliefSet>;
using Action = Aplib.Core.Intent.Actions.Action<Testing.AplibTests.GameplayBeliefSet>;
using Tactic = Aplib.Core.Intent.Tactics.Tactic<Testing.AplibTests.GameplayBeliefSet>;
using PrimitiveTactic = Aplib.Core.Intent.Tactics.PrimitiveTactic<Testing.AplibTests.GameplayBeliefSet>;
using GoalStructure = Aplib.Core.Desire.GoalStructures.GoalStructure<Testing.AplibTests.GameplayBeliefSet>;
using SequentialGoalStructure = Aplib.Core.Desire.GoalStructures.SequentialGoalStructure<Testing.AplibTests.GameplayBeliefSet>;
using DesireSet = Aplib.Core.Desire.DesireSets.DesireSet<Testing.AplibTests.GameplayBeliefSet>;
using BdiAgent = Aplib.Core.Agents.BdiAgent<Testing.AplibTests.GameplayBeliefSet>;
using TransformPathfinderAction = Aplib.Integrations.Unity.Actions.TransformPathfinderAction<Testing.AplibTests.GameplayBeliefSet>;
using DesireSet = Aplib.Core.Desire.DesireSets.DesireSet<Testing.AplibTests.GameplayBeliefSet>;
using Goal = Aplib.Core.Desire.Goals.Goal<Testing.AplibTests.GameplayBeliefSet>;
using GoalStructure = Aplib.Core.Desire.GoalStructures.GoalStructure<Testing.AplibTests.GameplayBeliefSet>;
using IGoalStructure = Aplib.Core.Desire.GoalStructures.IGoalStructure<Testing.AplibTests.GameplayBeliefSet>;
using InterruptGuard = System.Func<Testing.AplibTests.GameplayBeliefSet, bool>;
using PrimitiveTactic = Aplib.Core.Intent.Tactics.PrimitiveTactic<Testing.AplibTests.GameplayBeliefSet>;
using SequentialGoalStructure = Aplib.Core.Desire.GoalStructures.SequentialGoalStructure<Testing.AplibTests.GameplayBeliefSet>;
using Tactic = Aplib.Core.Intent.Tactics.Tactic<Testing.AplibTests.GameplayBeliefSet>;
using TransformPathfinderAction = Aplib.Integrations.Unity.Actions.TransformPathfinderAction<Testing.AplibTests.GameplayBeliefSet>;

namespace Testing.AplibTests
{
Expand Down Expand Up @@ -150,7 +150,7 @@ public class GameplayBeliefSet : BeliefSet
/// <summary> The position to which the player must navigate in order to fetch the end item. </summary>
public readonly Belief<GameObject, Vector3> EndItemPosition = new(
GameObject.Find(EndItemName), x => x.transform.position,
() => !GameObject.Find("InventoryObject").GetComponent<Inventory>().ContainsItem(EndItemName));
_ => !GameObject.Find("InventoryObject").GetComponent<Inventory>().ContainsItem(EndItemName));

/// <summary> The position of where the player started </summary>
public readonly Belief<Transform, Vector3> WinAreaPosition = new(
Expand Down Expand Up @@ -198,7 +198,7 @@ public readonly
? (enemy, distance)
: (null, 0f))
.Where(x => x.enemy != null)
.Aggregate((new AbstractEnemy[] {}, new float[] {}), (acc, x)
.Aggregate((new AbstractEnemy[] { }, new float[] { }), (acc, x)
=> (acc.Item1.Append(x.enemy).ToArray(), acc.Item2.Append(x.distance).ToArray())));

public readonly Belief<EnemiesObjectAndPlayerEyesReference, bool> AnyEnemyVisible = new(
Expand Down Expand Up @@ -229,8 +229,8 @@ public AbstractEnemy DetermineEnemyToFocus(out float distance)
int enemyPriority = enemies[i] switch
{
MeleeEnemy when distances[i] < 5 => 0,
RangedEnemy => 1,
_ => 2
RangedEnemy => 1,
_ => 2
};
groupedEnemies[enemyPriority].Add(i);
}
Expand Down Expand Up @@ -567,7 +567,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet)

DesireSet desireSet = new(
mainGoal: fetchElixir, // Fetch the elixir and bring it to the final room
sideGoals: new (IGoalStructure, InterruptGuard)[]
sideGoals: new (IGoalStructure, System.Predicate<GameplayBeliefSet>)[]
{
// But, when an item can be picked up, do so
(fetchVisibleItemGoal, beliefSet =>
Expand Down Expand Up @@ -743,7 +743,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet)
Transform playerRotation = beliefSet.PlayerRotation.Observation.transform;
Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position;
playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor
} );
});
PrimitiveTactic sleep = new(sleepAction, _ => Time.time < wakeUpTimeStamp);


Expand Down Expand Up @@ -860,7 +860,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet)

DesireSet desireSet = new(
mainGoal: fetchElixir, // Fetch the elixir and bring it to the final room
sideGoals: new (IGoalStructure, InterruptGuard)[]
sideGoals: new (IGoalStructure, System.Predicate<GameplayBeliefSet>)[]
{
// But, when an item can be picked up, do so
(fetchVisibleItemGoal, beliefSet =>
Expand Down
2 changes: 1 addition & 1 deletion aplib.net-demo/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "374c6a03c09eb8938d0377d7317e9e064b519b6f"
"hash": "7fd7754cebd06c5407d107bc0c273f539f88c9b7"
},
"com.unity.ai.navigation": {
"version": "1.1.5",
Expand Down

0 comments on commit 776a5b9

Please sign in to comment.