Did some work

This commit is contained in:
Isaac Shoebottom 2023-02-13 19:38:57 -04:00
parent 7f94dd7761
commit 3ceb5634df
9 changed files with 142 additions and 8 deletions

View File

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.MAAC3601-TD-Game.iml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -10,6 +10,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 4476842061966021075} - component: {fileID: 4476842061966021075}
- component: {fileID: 2981135554967256007} - component: {fileID: 2981135554967256007}
- component: {fileID: 1540579659150390887}
- component: {fileID: 7146678828090736945}
m_Layer: 0 m_Layer: 0
m_Name: Generation m_Name: Generation
m_TagString: Untagged m_TagString: Untagged
@ -84,3 +86,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!114 &1540579659150390887
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1458536803320539101}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6d151e6102b72db4590ce83309573f1c, type: 3}
m_Name:
m_EditorClassIdentifier:
PathGameObject: {fileID: 0}
--- !u!50 &7146678828090736945
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1458536803320539101}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0

View File

@ -491,7 +491,7 @@ GameObject:
- component: {fileID: 1292283378} - component: {fileID: 1292283378}
- component: {fileID: 1292283377} - component: {fileID: 1292283377}
m_Layer: 0 m_Layer: 0
m_Name: Pathing m_Name: Path
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -509,6 +509,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 62f8cdc29b6f43e4998a2750b3b9a023, type: 3} m_Script: {fileID: 11500000, guid: 62f8cdc29b6f43e4998a2750b3b9a023, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
waypointPrefab: {fileID: 2624247600710686983, guid: fad75b8b6a5d5a6468eef0f0782ea835, type: 3}
enemyPrefab: {fileID: 1458536803320539101, guid: f1eab3cea41682c4ba2ff7c2b218fc0b, type: 3}
--- !u!4 &1292283378 --- !u!4 &1292283378
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1,13 +1,24 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class GenerationController : MonoBehaviour public class GenerationController : MonoBehaviour {
{
public GameObject PathGameObject;
private Rigidbody2D rb;
int pathIndex = 0;
bool moving = false;
private GameObject pathPointer;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
rb = GetComponent<Rigidbody2D>();
PathGameObject = GameObject.Find("Path");
} }
// Update is called once per frame // Update is called once per frame
@ -15,4 +26,22 @@ public class GenerationController : MonoBehaviour
{ {
} }
private void FixedUpdate() {
pathPointer = PathGameObject.GetComponent<PathingController>().waypointList[pathIndex] as GameObject;
if (!moving) {
Vector2 force = new Vector2(pathPointer.transform.position.x, pathPointer.transform.position.y);
rb.AddForce(force);
moving = true;
}
}
private void OnTriggerEnter2D(Collider2D col) {
if (col.gameObject == pathPointer) {
moving = false;
pathIndex++;
}
}
} }

View File

@ -1,15 +1,25 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class PathingController : MonoBehaviour public class PathingController : MonoBehaviour {
{
public GameObject waypointPrefab;
public ArrayList waypointList = new ArrayList();
public GameObject enemyPrefab;
private ArrayList enemyList = new ArrayList();
int counter = 0;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
waypointList.Add(Instantiate(waypointPrefab, new Vector3(0, 0, 0), Quaternion.identity));
waypointList.Add(Instantiate(waypointPrefab, new Vector3(0, 5, 0), Quaternion.identity));
waypointList.Add(Instantiate(waypointPrefab, new Vector3(5, 5, 0), Quaternion.identity));
} }
@ -18,4 +28,17 @@ public class PathingController : MonoBehaviour
{ {
} }
private void FixedUpdate() {
if (counter == 0) {
enemyList.Add(Instantiate(enemyPrefab));
counter++;
}
else if (counter >= 50) {
counter = 0;
}
else {
counter++;
}
}
} }

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3}
m_Name:
m_EditorClassIdentifier:
customInterpolatorErrorThreshold: 32
customInterpolatorWarningThreshold: 16