Tuesday 6 May 2014

Steampunk: Building The Game

I have made the build for the final game which will be on the hand-in CD this file contains three scenes 0 is the main menu 1 one is the steam punk world with the normal character controller unit and number 2 is the same environment but with an oculus rift character controller both of fees scenes are accessible through the main menu screen which has been updated below and now contains code that allows the player to choose each environment and when in the environment have no mouse visible onscreen and be able to exit the game by simply pressing escape.


i have also made a icon file for the game which you can see below this is an icon file and can be added as shown below.









this was not a need asset in the final game I just thought it would be a nice touch to the game folder by having this icon over it instead of the normal default file picture as you can see below this is implemented on the actual physical steam game folder with the EXE and the data file inside of it.








Below are the three code scripts that allow what I discussed above to function in the game

// This simple script below centres the mouse cursor and also makes it invisible in the game build which helps immerse the player instead of having a mouse pointer hovering in the centre of the screen

#pragma strict

function Start () {
Screen.lockCursor = true;
}

function Update()
{

}

also when the mouse is invisible which this code above has inflicted on the game it is now impossible to escape again without doing control alt delete sub by adding this simple code below where you press escape it the game will exit

using UnityEngine;
using System.Collections;

public class Escape : MonoBehaviour {




// Use this for initialization
void Start () {

}

// Update is called once per frame
void FixedUpdate () {

if(Input.GetKeyDown (KeyCode.Escape))
  {
Application.Quit ();
}
}


}

below is the main manu script that allows the play the normal game the play the oculus and exit the game using this code below

var isQuit=false;

function OnMouseEnter(){
//change text color
renderer.material.color=Color.red;
}

function OnMouseExit(){
//change text color
renderer.material.color=Color.white;
}

function OnMouseUp(){

if(this.gameObject.name=="GUIPlay")
{
Application.LoadLevel(1);
}

if(this.gameObject.name=="GUIPlayOcc")
{
Application.LoadLevel(2);
}

if(this.gameObject.name=="GUIExit")
{
Application.Quit();
}
}

No comments:

Post a Comment