Dupont An Phu

Game developer, retro-computing enthusiast

Mega Lab Escape

You are a lab-rat trapped in a ball. You have to roll your way to freedom by avoiding dangerous traps.
This is a physics game made with Unity and C# in a team of two programmers and two artists.

I was tasked with handling controls, camera and parts of the game mechanics; while my partner did the UI, sound and other game mechanics.

This game was featured as one of the best games from all teams (around 20 !),
and as the only one from the English language group.

Our game is playable here.
You can also check out the post on the Digital Arts and Entertainment website.

//
// Example taken from PickUpTemplate.cs
//

using UnityEngine;
using System.Collections;

// Inherit from this class
public abstract class PickUpTemplate : MonoBehaviour
{
  // Public variables
  public bool Active = true;
  public bool HideOnHit = true;

  // Private variables
  protected GameObject _player;
  protected LevelScript _levelScript;

  // Override these functions, using the override keyword
  public virtual void StartPickup() { }
  public virtual void UpdatePickup() { }
  public abstract void OnTriggerEnterPickup(Collider other);

  // Use this for initialization
  void Start()
  {
    _player = GameObject.FindGameObjectWithTag( " Player " );
    _levelScript = GameObject.Find( " ScriptObject " ).GetComponent < LevelScript > ();
    StartPickup();
  }

  // Update is called once per frame
  void Update ()
  {
    if (Active & & !MenuScript.IsPaused)
    {
      // Do update here
      UpdatePickup();
    }
  }

  void OnTriggerEnter(Collider other)
  {
    if (Active & & other.tag.Equals( " Player " ))
    {
      if (HideOnHit)
      {
        LevelScript.savedProperties._pickups.Add(this);
        SetPickupActive(false);
      }

      OnTriggerEnterPickup(other);
    }
  }

  public void SetPickupActive(bool active)
  {
    Active = active;
    if (Active)
    {
      GetComponent < Collider > ().enabled = true;
      GetComponent < Renderer > ().enabled = true;
      var renderers = GetComponentsInChildren < Renderer > ();
      foreach (var renderer in renderers)
      {
        renderer.enabled = true;
      }
    }
    else
    {
      GetComponent < Collider > ().enabled = false;
      GetComponent < Renderer > ().enabled = false;
      var renderers = GetComponentsInChildren < Renderer > ();
      foreach (var renderer in renderers)
      {
        renderer.enabled = false;
      }
    }
  }
}