Category Archives: Uncategorized

Android app… The Great Escape!!!

Android app… The Great Escape!!!

Download here

Spillet er laget i Unity3d og kan spilles i android…

Scriptet med C#…

exempel script:

 

///

PlayerScore.cs

Marcus Rognes

20.10.2011

This Script controls all the player stats, level unlocks and so on.

///

using UnityEngine;
using System;
using System.Collections.Generic;
using System.Collections;

public class PlayerScore : MonoBehaviour {
public float playerScore;
public float timesDied;
public float timeUsed;
public bool isPlaying;
public bool isFinished;
public GUISkin MenuStyle;
public bool isLevel1Finished;
public bool isLevel2Finished;
public bool isLevel3Finished;
private Transform _myTransform;

// Use this for initialization
void Awake () {
_myTransform = transform;
PlayerPrefs.GetFloat(“playerScore”, playerScore);
PlayerPrefs.GetFloat(“timesDied”, timesDied);
PlayerPrefs.GetFloat(“timeUsed”, timeUsed);
isFinished = false;
DontDestroyOnLoad(transform.gameObject);
}

void OnGUI () {
GUI.skin = MenuStyle;

if(isPlaying) {
_myTransform.GetComponent<AudioListener>().enabled = false;
iPhoneSettings.screenCanDarken = false;

timeUsed += Time.deltaTime;

GUI.TextArea(new Rect(10, 10, 200, 20), “Score: ” + playerScore);
GUI.TextArea(new Rect(Screen.width – 200, 10, 200, 20), “Time: ” + timeUsed);
}

else {
_myTransform.GetComponent<AudioListener>().enabled = true;
iPhoneSettings.screenCanDarken = true;
}

if(isFinished) {
GUI.TextArea(new Rect(10, 10, Screen.width / 2 – 20, 200), “Youre Score Is: ” + playerScore);
GUI.TextArea(new Rect(Screen.width / 2 + 20 – 20, 10, Screen.width / 2 – 10, 200), “The Time You Used To Finish The Level; ” + timeUsed + “Seconds”);
GUI.TextArea(new Rect(Screen.width / 2 – 100, Screen.height – 60, 200, 50), “Times You Fell Off The Map; ” + timesDied);
if(GUI.Button(new Rect(10, Screen.height – 60, 200, 50), “LevelSelect”)){
Application.LoadLevel(“LevelSelect”);
isFinished = false;
PlayerPrefs.SetFloat(“playerScore”, playerScore);
PlayerPrefs.SetFloat(“timesDied”, timesDied);
PlayerPrefs.SetFloat(“timeUsed”, timeUsed);
Save();
}
}

}

void Save() {

}

}

 

///////////////

 

Ganske Basic…