GameOver: Refactor from timer screen to submit score/play again

parent 34ade000
fileFormatVersion: 2
guid: 2193b2c370579481da2949d275ff44dd
timeCreated: 1477625045
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
using Assets.Scripts;
using Assets.Scripts.API;
public class GameOver : MonoBehaviour
{
private float _timer = 0f;
private int score;
private Player _player;
public InputField PlayerName;
public InputField TeamName;
public Text Score;
void Start()
{
_player = GameObject.FindWithTag("Player").GetComponent<Player>();
score = _player.Score;
Score.text = "You scored " + score;
}
void Update ()
{
// _timer += Time.deltaTime;
// if (_timer > 4f)
// SceneManager.LoadScene("Menu");
}
public void OnButtonPlayClicked()
{
SceneManager.LoadScene("Main");
}
public void OnButtonSubmitClicked()
{
string playerText = PlayerName.text;
if (playerText == null || playerText.Length == 0) {
playerText = "Random Randy";
}
string teamText = PlayerName.text;
if (teamText == null || teamText.Length == 0) {
teamText = null;
}
Server.PostScore(score, playerText, teamText);
}
}
fileFormatVersion: 2
guid: db1617bc54ffa5d418ba76a2af51731b
timeCreated: 1477408259
guid: 87812edcd943348fb992562afc20f611
timeCreated: 1477625221
licenseType: Free
MonoImporter:
serializedVersion: 2
......
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class GameOverTimeout : MonoBehaviour
{
private float _timer = 0f;
void Start()
{
}
void Update ()
{
_timer += Time.deltaTime;
if (_timer > 4f)
SceneManager.LoadScene("Menu");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment