Skip to content

Commit

Permalink
Merge pull request #28 from Capstone-Projects-2021-Spring/Integrate-AI
Browse files Browse the repository at this point in the history
Integrate ai
  • Loading branch information
CollinRehmeyer-templeU authored Apr 12, 2021
2 parents e69605c + 9f3e712 commit f76c710
Show file tree
Hide file tree
Showing 42 changed files with 89,385 additions and 5,725 deletions.

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

43 changes: 43 additions & 0 deletions Assets/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,57 @@
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
using System.IO;

public class GameManager : MonoBehaviourPunCallbacks
{
public static GameManager Instance;
GameObject controller;
int botCount;

private void Awake()
{
Instance = this;
botCount = (int)PhotonNetwork.CurrentRoom.CustomProperties["bots"];
}

private void Start()
{
//SpawnHazards();
for (int i = 0; i < botCount; i++)
SpawnAI();
}

void SpawnHazards()
{
PhotonNetwork.InstantiateRoomObject(Path.Combine("PhotonPrefabs", "ExplosiveBarrel"), Vector3.zero, Quaternion.identity);
}

// used to spawn an AI character...
void SpawnAI()
{
// create an AI controller for the AI character...
CreateAIController();
}

// uses the 'CreateController()' method from the 'PlayerManager.cs' scipt as template for creating AI players...
void CreateAIController()
{
// instantiate AI controller
Transform spawnPoint = SpawnManager.Instance.GetSpawnPoint();
PhotonNetwork.InstantiateRoomObject(Path.Combine("PhotonPrefabs", "AI"), spawnPoint.position, spawnPoint.rotation);
}

public void DestroyHazard(GameObject hazard)
{
PhotonNetwork.Destroy(hazard);
Invoke("SpawnHazards", 3);
}

public void DestroyAI(GameObject AI)
{
PhotonNetwork.Destroy(AI);
Invoke("SpawnAI", 3);
}

public override void OnLeftRoom()
Expand Down
11 changes: 5 additions & 6 deletions Assets/Prefabs/ExplosiveBarrel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3019397336027699907}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4.57, y: -8.3196745, z: 1.89}
m_LocalPosition: {x: 4.5700006, y: -8.3196745, z: 2.54}
m_LocalScale: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_Children: []
m_Father: {fileID: 8752209113046767679}
m_RootOrder: 1
m_Father: {fileID: 7676693694191755891}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &4489949564565562280
AudioSource:
Expand Down Expand Up @@ -155,7 +155,6 @@ Transform:
m_LocalScale: {x: 3, y: 3, z: 3}
m_Children:
- {fileID: 7676693694191755891}
- {fileID: 4942021052399868613}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -189,7 +188,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.65}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 4942021052399868613}
m_Father: {fileID: 8752209113046767679}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -250,7 +250,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0a3283eab5e3bf9448457458345b22a4, type: 3}
m_Name:
m_EditorClassIdentifier:
Barrel: {fileID: 4804425440242981634}
explosionEffect: {fileID: 1000011797152326, guid: acf39d9f4addf294d93fa56fa373961b,
type: 3}
explosionSound: {fileID: 4489949564565562280}
Expand Down
Loading

0 comments on commit f76c710

Please sign in to comment.