Project: Nahaulis – A Gun of Three Spirits

Tools and Technology: C#, Unity, PhotoShop, Agile/SCRUM

“Nahaulis: A Gun of Three Spirits is a 2D explorative, action-adventure game that takes place in an Aztec temple where the player uses Nahaulis to defeat the manifested god, Tezcatlipoca.”

My development group and I spent a month and a half creating this platformer in multiple Agile sprints. My responsibilities included projectiles, minimap, animatics, a few enemies, and a lot of bug hunting.

C# code for the part of the minimap controller.

void DisableAllMapSquares()
	{
		for (int i = 0; i < gom_MinimapSquares.Length; i++) {
			gom_MinimapSquares[i].SetActive(false);
		}

		gom_AlternateEndingSquare.SetActive(false);

	}

	int GetMiniMapIndexByRoomAndSquare(int _mmRoom, int _mmSquare)
	{
		for (int i = 0; i < m_MinimapSquares.Length; ++i) {
			if ((_mmRoom == m_MinimapSquares[i].RoomIndex)&&(_mmSquare == m_MinimapSquares[i].SquareIndex)) {
				return i;
			}
		}
		return -1;
	}

	public void LoadMinimapRoomsFromPlayerPrefs()
	{
		string currentRoomString;
		for (int i = 1; i <= 28; i++) {
		if (PlayerPrefs.HasKey ("MM_ActiveRoom_" + i) && PlayerPrefs.GetString("MM_ActiveRoom_" + i).Length >= 8) {
                    currentRoomString = PlayerPrefs.GetString ("MM_ActiveRoom_" + i);
				for (int square = 0; square < 8; square++) {
					if ("1" == currentRoomString.Substring (7 - square, 1)) {
						ActivateMinimapRoomAndSquare (i, square);
					}
				}
			}
		}
	}

	void TurnOnPlayerPrefSquare(int _mmRoom, int _mmSquare)
	{
        // This resets the entire room to ZERO.  DO NOT USE, EVERRRRRRRRRRR
        //PlayerPrefs.SetString ("MM_ActiveRoom_" + _mmRoom, "00000000");
        //return;

        //Debug.Log(PlayerPrefs.GetString("MM_ActiveRoom_" + _mmRoom).Length + " " + _mmSquare);

		if (!PlayerPrefs.HasKey ("MM_ActiveRoom_" + _mmRoom) || PlayerPrefs.GetString("MM_ActiveRoom_" + _mmRoom).Length < 8) 
		{
			PlayerPrefs.SetString ("MM_ActiveRoom_" + _mmRoom, "00000000");
		}
			
		string tempString = PlayerPrefs.GetString ("MM_ActiveRoom_" + _mmRoom);

		if ("0" == tempString.Substring(7 - _mmSquare, 1)) { // If it's not yet set:
			string ReturnString = "";
			for (int i = 0; i < 8; i++) {
				if ((7 - _mmSquare) == i) {
					ReturnString += "1";
				} else {
					ReturnString += tempString.Substring (i, 1);
				}
			}
			PlayerPrefs.SetString ("MM_ActiveRoom_" + _mmRoom, ReturnString);
		}
}



	public void ActivateMinimapRoomAndSquare(int _mmRoom, int _mmSquare, bool _isFromRoomMap = false)
	{
		m_currentRoom = _mmRoom;
		m_currentSquare = _mmSquare;

		// Set the PlayerPrefs appropriately
		TurnOnPlayerPrefSquare(_mmRoom, _mmSquare);


		// Turn on the Game Object
		gom_MinimapSquares[GetMiniMapIndexByRoomAndSquare(_mmRoom,_mmSquare)].SetActive(true);

		// Update the minimap position
		Vector2 currentMapPosition = GetMapPositionFromRoomAndSquare(_mmRoom, _mmSquare);
		m_TargetPosition = new Vector2(m_BaseX - (m_MMUnitMultiplier * currentMapPosition.x) + m_OffsetX, m_BaseY + (m_MMUnitMultiplier * currentMapPosition.y) + m_OffsetY);

		// Jump to the current room the first time
		if ((_isFromRoomMap)&&(!m_bHasInitialized)) {
			m_MapPartContainer.transform.position = m_TargetPosition;
			m_bHasInitialized = true;
		}
	}