Skip to content

Commit

Permalink
ai does stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHuntsmanbuh committed Sep 11, 2024
1 parent 3bd1fef commit 49f2eb4
Show file tree
Hide file tree
Showing 16 changed files with 769 additions and 765 deletions.
Binary file modified smartnet_bots/.vs/ProjectEvaluation/smartnet_bots.metadata.v5.1
Binary file not shown.
Binary file modified smartnet_bots/.vs/ProjectEvaluation/smartnet_bots.projects.v5.1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified smartnet_bots/.vs/smartnet_bots/v17/.futdcache.v2
Binary file not shown.
Binary file modified smartnet_bots/.vs/smartnet_bots/v17/.suo
Binary file not shown.
Binary file modified smartnet_bots/.vs/smartnet_bots/v17/fileList.bin
Binary file not shown.
728 changes: 728 additions & 0 deletions smartnet_bots/Assets/prefabs/sn_human.prefab

Large diffs are not rendered by default.

757 changes: 7 additions & 750 deletions smartnet_bots/Assets/scenes/minimal.scene

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
49 changes: 34 additions & 15 deletions smartnet_bots/code/thought.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public static class Thoughts
//constantly updated variables go here eg: nearby bots or current health\\
public static int NearbyFriends = 0; public static int NearbyEnimies = 0;
public static int CurrentHealth = 0;
public static Vector3 myposition;
public static Vector3 targetposition;

//bot related variables eg:"closest friend" or "closest enemy"\\
public static string LastPersonToHurtMe = BNULL; public static int DistantToDamage = 0;
Expand All @@ -30,10 +32,10 @@ public static class Thoughts
public static bool Panicked = false; // if set to true the ai will go into a custom panicked script
[Property] public static bool AgressiveMode { get; set; }

//movement states and variables eg: "IsAnimating" or "InFreefall"\\
public static bool IsAnimating = false; // if the bot is in a custom animation this will set to TRUE
//movement states and variables eg: "IsAnimating" or "InFreefall"\\
public static bool IsAnimating = false; // if the bot is in a custom animation this will set to TRUE
public static bool InFreefall = false; // if the bot is falling this will be set to true so no other actions are performed midair

public static int SearchRadius = 128;
}


Expand All @@ -48,31 +50,48 @@ async Task MainAiLoop()
{
while ( Thoughts.InFreefall == false )
{
var mypos = Agent.Transform.Position;
var test = Scene.Directory.FindByName( "Cube" ).First();
var p = test.Transform.Position;
Agent.MoveTo( p );

Agent.MoveTo( Thoughts.targetposition );
await Task.DelaySeconds(1);
p = test.Transform.Position;
mypos = Agent.Transform.Position;

while ( p != mypos )
{


}


}
await Task.DelaySeconds( 15 );
await Task.DelaySeconds( 1 );
}
async Task Roam()
{
Vector3? movto = Scene.NavMesh.GetRandomPoint( Agent.Transform.Position, 500f );
Agent.MoveTo( movto.Value );

while ( movto != Thoughts.myposition )
{
await Task.DelaySeconds( 5 );
}
await Task.DelaySeconds( 5 );
}

protected override void OnStart()
{

Roam();

MainAiLoop();


}

protected override void OnUpdate()
{
Thoughts.myposition = Agent.Transform.Position;
var target = Scene.Directory.FindByName( "Cube" ).First();
Thoughts.targetposition = target.Transform.Position;
if ( target == null )
{


}
}
}


Expand Down

0 comments on commit 49f2eb4

Please sign in to comment.