Skip to content

Commit

Permalink
Merge pull request #79 from iamtomhewitt/develop
Browse files Browse the repository at this point in the history
2.11.1-BETA
  • Loading branch information
iamtomhewitt authored Feb 21, 2020
2 parents bf4b334 + ae979b5 commit 30aeac9
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 104 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Logs/
/ProjectSettings/ProBuilderSettings.json
/Assembly-CSharp.csproj
/Assembly-CSharp-Editor.csproj
Packages
/Assets/config.json
/Assets/config.json.meta
/Google Play Store/Video/Video.mp4
10 changes: 3 additions & 7 deletions Assets/Scenes/Main Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
--- !u!196 &4
Expand Down Expand Up @@ -650,6 +651,7 @@ ParticleSystemRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
Expand Down Expand Up @@ -5393,7 +5395,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 183.9}
m_AnchoredPosition: {x: 0, y: -4}
m_SizeDelta: {x: 100, y: 19.05}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &480786297
Expand Down Expand Up @@ -6492,12 +6494,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4975a6e437fc3b149a8cd508ce5bdd69, type: 3}
m_Name:
m_EditorClassIdentifier:
threshold: 0.25
intensity: 0.75
blurSize: 1
blurIterations: 1
blurType: 0
fastBloomShader: {fileID: 4800000, guid: 68a00c837b82e4c6d92e7da765dc5f1d, type: 3}
--- !u!1 &1362946542
GameObject:
m_ObjectHideFlags: 0
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Editor/GhostPathEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void OnInspectorGUI()
{
if (child.name.Contains("Waypoint"))
{
ghostPath.waypoints.Add(child);
ghostPath.GetWaypoints().Add(child);
}
}
}
Expand All @@ -43,7 +43,7 @@ public override void OnInspectorGUI()

if (GUILayout.Button("Reset"))
{
ghostPath.waypoints.Clear();
ghostPath.GetWaypoints().Clear();
}
}
}
13 changes: 7 additions & 6 deletions Assets/Scripts/Ghosts/Ghost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ namespace Ghosts
{
public class Ghost : MonoBehaviour
{
public Material originalColour;
[SerializeField] private Material originalColour;

[SerializeField] private bool edible = false;
[SerializeField] private bool eaten = false;
[SerializeField] private bool runningHome = false;

[SerializeField] private float speed;
[SerializeField] private float movingSpeed;
[SerializeField] private float flashingSpeed;
Expand All @@ -24,13 +23,15 @@ public class Ghost : MonoBehaviour
private Rigidbody rb;
private MeshRenderer bodyColour;
private Debugger debugger;

private Coroutine flashRoutine;

private Vector3 originalPosition;

private void Start()
{
rb = GetComponent<Rigidbody>();
debugger = GetComponent<Debugger>();
originalPosition = transform.position;

path = GetRandomPath();
debugger.Info("has selected path: " + path.gameObject.name);
Expand All @@ -45,7 +46,7 @@ private void FixedUpdate()

private void OnTriggerEnter(Collider o)
{
if (o.name == Constants.GHOST_HOME)
if (o.name.Equals(Constants.GHOST_HOME))
{
Reset();
AudioManager.instance.StopGhostRunSound();
Expand Down Expand Up @@ -149,9 +150,9 @@ private void Reset()
}
}

public void ResetPosition(int offset)
public void ResetPosition()
{
transform.position = new Vector3((-1.5f + offset), 0f, -1.5f);
transform.position = originalPosition;
}

public void RunHome()
Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/Ghosts/GhostPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Ghosts
{
public class GhostPath : MonoBehaviour
{
public List<Transform> waypoints;
[SerializeField] private List<Transform> waypoints;

private bool used;
private int currentWaypointIndex = 0;
Expand All @@ -17,6 +17,11 @@ public Transform GetCurrentWaypoint()
return waypoints[currentWaypointIndex];
}

public List<Transform> GetWaypoints()
{
return waypoints;
}

public void SetNextWaypoint()
{
currentWaypointIndex = (currentWaypointIndex + 1) % waypoints.Count;
Expand Down
5 changes: 2 additions & 3 deletions Assets/Scripts/Manager/AudioManager.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using UnityEngine;
using System;
using System.Linq;
using Ghosts;
using System.Collections;
using System.Collections.Generic;
using Ghosts;

namespace Manager
{
public class AudioManager : MonoBehaviour
{
public Sound[] sounds;
[SerializeField] private Sound[] sounds;

public static AudioManager instance;

Expand Down
60 changes: 28 additions & 32 deletions Assets/Scripts/Manager/GameObjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ namespace Manager
/// </summary>
public class GameObjectManager : MonoBehaviour
{
public GameObject cherry;
public GameObject ghostHome;
[SerializeField] private GameObject cherry;
[SerializeField] private GameObject ghostHome;
[SerializeField] private Transform cherrySpawn;

private GameObject[] foods;
private GameObject[] food;
private GameObject[] powerups;
private Ghost[] ghosts;

[SerializeField] private Transform cherrySpawn;

private int foodCount;
private bool spawnedCherry;
private Debugger debugger;
Expand All @@ -33,7 +32,7 @@ private void Awake()

private void Start()
{
foods = GameObject.FindGameObjectsWithTag("Food");
food = GameObject.FindGameObjectsWithTag("Food");
powerups = GameObject.FindGameObjectsWithTag("Powerup");
ghosts = FindObjectsOfType<Ghost>();
debugger = GetComponent<Debugger>();
Expand All @@ -42,11 +41,11 @@ private void Start()

foodCount = CountFood();

for (int i = 0; i < foods.Length; i++)
for (int i = 0; i < food.Length; i++)
{
// Name the food "Food ([coordinates])
foods[i].name = "Food (" + foods[i].transform.position.x.ToString() + ", " + foods[i].transform.position.z.ToString() + ")";
foods[i].transform.parent = this.transform;
food[i].name = "Food (" + food[i].transform.position.x.ToString() + ", " + food[i].transform.position.z.ToString() + ")";
food[i].transform.parent = this.transform;
}

InvokeRepeating("SpawnCherry", 10f, 10f);
Expand All @@ -57,16 +56,14 @@ private void Start()
/// </summary>
public void MakeGhostsEdible()
{
for (int i = 0; i < ghosts.Length; i++)
{
Ghost g = ghosts[i];

foreach (Ghost ghost in ghosts)
{
// Only want to become edible if we are not running home
if (!g.IsRunningHome())
if (!ghost.IsRunningHome())
{
g.BecomeEdible();
ghost.BecomeEdible();
}
}
}
}

/// <summary>
Expand All @@ -78,11 +75,10 @@ public void StartMovingEntities()

PacmanMovement.instance.ResetSpeed();

// Reset the Ghosts speed and their path node
for (int i = 0; i < ghosts.Length; i++)
{
Ghost g = ghosts[i];
g.SetSpeed(g.GetMovingSpeed());
// Reset the Ghosts speed and their path node
foreach (Ghost ghost in ghosts)
{
ghost.SetSpeed(ghost.GetMovingSpeed());
}

foreach (GhostPath path in GameObject.FindObjectsOfType<GhostPath>())
Expand All @@ -97,11 +93,11 @@ public void StartMovingEntities()
public void StopMovingEntities()
{
debugger.Info("stopping everything");

for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].StopMoving();
}
foreach (Ghost ghost in ghosts)
{
ghost.StopMoving();
}

PacmanMovement.instance.Stop();
}
Expand All @@ -113,13 +109,13 @@ public void ResetEntityPositions()
{
debugger.Info("resetting positions");

for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].ResetPosition(i);
foreach (Ghost ghost in ghosts)
{
ghost.ResetPosition();
}

// We reset the current node here to stop the Ghosts immediately looking at the first node when pacman dies
foreach (GhostPath path in GameObject.FindObjectsOfType<GhostPath>())
foreach (GhostPath path in FindObjectsOfType<GhostPath>())
{
path.ResetCurrentWaypointIndex();
}
Expand All @@ -133,9 +129,9 @@ public void ResetEntityPositions()
/// </summary>
public void ActivateFood()
{
for (int i = 0; i < foods.Length; i++)
for (int i = 0; i < food.Length; i++)
{
foods[i].SetActive(true);
food[i].SetActive(true);
}
}

Expand Down
6 changes: 2 additions & 4 deletions Assets/Scripts/Manager/HighscoreManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ namespace Manager
{
public class HighscoreManager : MonoBehaviour
{
private const string url = "http://dreamlo.com/lb/";

public static HighscoreManager instance;

private void Awake()
Expand Down Expand Up @@ -64,7 +62,7 @@ private IEnumerator UploadNewHighscoreRoutine(string username, int score)

string privateCode = Config.instance.GetConfig()["dreamlo"]["privateKey"];

UnityWebRequest request = UnityWebRequest.Post(url + privateCode + "/add/" + username + "/" + score, "");
UnityWebRequest request = UnityWebRequest.Post(Constants.DREAMLO + privateCode + "/add/" + username + "/" + score, "");
yield return request.SendWebRequest();

if (!request.downloadHandler.text.StartsWith("ERROR"))
Expand Down Expand Up @@ -100,7 +98,7 @@ private IEnumerator DownloadHighscoresRoutine()

string publicCode = Config.instance.GetConfig()["dreamlo"]["publicKey"];

UnityWebRequest request = UnityWebRequest.Get(url + publicCode + "/json/0/10");
UnityWebRequest request = UnityWebRequest.Get(Constants.DREAMLO + publicCode + "/json/0/10");
yield return request.SendWebRequest();

if (!request.downloadHandler.text.StartsWith("ERROR"))
Expand Down
10 changes: 5 additions & 5 deletions Assets/Scripts/Pacman/MinimapPacmanIcon.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Pacman
{
Expand All @@ -9,9 +9,9 @@ namespace Pacman
/// </summary>
public class MinimapPacmanIcon : MonoBehaviour
{
public Transform pacman;
public Vector3 transformOffset;
public Vector3 rotationOffset;
[SerializeField] private Transform pacman;
[SerializeField] private Vector3 transformOffset;
[SerializeField] private Vector3 rotationOffset;

private void Update()
{
Expand Down
9 changes: 4 additions & 5 deletions Assets/Scripts/Pacman/PacmanCollision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ namespace Pacman
/// </summary>
public class PacmanCollision : MonoBehaviour
{
public bool godMode;

public int currentLives = 3;
[SerializeField] private bool godMode;
[SerializeField] private int currentLives = 3;

private Rigidbody rb;
private Debugger debugger;
Expand Down Expand Up @@ -48,7 +47,7 @@ private void OnCollisionEnter(Collision other)
break;

case "Powerup":
debugger.Info("Activated powerup");
debugger.Info("activated powerup");
other.gameObject.SetActive(false);
AudioManager.instance.PlayForDuration(SoundNames.GHOST_EDIBLE, Constants.POWERUP_DURATION);
GameObjectManager.instance.MakeGhostsEdible();
Expand Down Expand Up @@ -139,4 +138,4 @@ private IEnumerator Die()
}
}
}
}
}
5 changes: 2 additions & 3 deletions Assets/Scripts/Pacman/PacmanHud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ namespace Pacman
/// </summary>
public class PacmanHud : MonoBehaviour
{
public GameObject[] lifeSprites;

[SerializeField] private GameObject[] lifeSprites;
[SerializeField] private TextMesh statusText;
[SerializeField] private TextMesh scoreText;

Expand Down Expand Up @@ -42,4 +41,4 @@ public void RemoveLife(int index)
lifeSprites[index].SetActive(false);
}
}
}
}
Loading

0 comments on commit 30aeac9

Please sign in to comment.