Skip to content

Commit

Permalink
initial commit, finished workbook
Browse files Browse the repository at this point in the history
  • Loading branch information
nurn2 committed Nov 6, 2024
1 parent a86909c commit 09cab07
Show file tree
Hide file tree
Showing 40 changed files with 5,213 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
27 changes: 27 additions & 0 deletions Assets/MoveToTarget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class MoveToTarget : MonoBehaviour
{
public Transform target;
public Transform agentPos;
NavMeshAgent agent;
[SerializeField]
Vector3 distance;
// Start is called before the first frame update
void Start()
{
agent = GetComponent<NavMeshAgent>();
agentPos = GetComponent<Transform>();
agent.destination = target.transform.position;
}
void Update()
{
distance = target.transform.position - agentPos.transform.position;
if (distance.x < 5 || distance.z < 5 && distance.x > 5 || distance.z > 5)
{
agent.destination = target.transform.position;
}
}
}
11 changes: 11 additions & 0 deletions Assets/MoveToTarget.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Scenes/SampleScene.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 09cab07

Please sign in to comment.