// Use this for initialization void Start() { label = GetComponent <UILabel>(); matchData = null; Random.seed = (int)(Time.time * 313751); UpdateDeathWords(); }
// Update is called once per frame void Update () { if (matchData == null) { Spaceship ship = GameplayManager.spaceship; if (ship != null) { matchData = GameplayManager.spaceship.GetComponent<SpaceshipMatchData>(); } } else { label.text = string.Format("Time: {0}", matchData.timeElapsed); } }
// Update is called once per frame void Update() { if (matchData == null) { Spaceship ship = GameplayManager.spaceship; if (ship != null) { matchData = GameplayManager.spaceship.GetComponent <SpaceshipMatchData>(); } } else { label.text = string.Format("Time: {0}", matchData.timeElapsed); } }
// Update is called once per frame void Update() { if (matchData == null) { Spaceship ship = GameplayManager.spaceship; if (ship != null) { matchData = GameplayManager.spaceship.GetComponent <SpaceshipMatchData>(); spaceshipHealth = GameplayManager.spaceship.GetComponent <SpaceshipHealth>(); } } else { if (matchData.spawnTimeRemaining > 1.0f) { if (matchData.lastKilledBy == matchData.spaceship.gameObject) { label.text = string.Format("Suicide!\nRespawning in {0}...", (int)matchData.spawnTimeRemaining); } else { label.text = string.Format("{0} {1} by Player {2}!\nRespawning in {3}...", currentDeathAdjective, currentDeathVerb, (spaceshipHealth.lastHurtByPlayerID + 1), (int)matchData.spawnTimeRemaining); } } else if (matchData.spawnTimeRemaining > 0.0f) { label.text = string.Format("Preparing for descent..."); UpdateDeathWords(); } else if (MatchManager.lastKilledPlayerId != -1) { if (MatchManager.lastKilledPlayerIdLastFrame != MatchManager.lastKilledPlayerId) { UpdateDeathWords(); } label.text = string.Format("{0} {1} Player {2}!", currentDeathAdjective, currentDeathVerb, (MatchManager.lastKilledPlayerId + 1)); } else { label.text = ""; } } }
public override void Start() { base.Start(); currentHealth = maxHealth; matchManager = GameObject.FindGameObjectWithTag("MatchManager").GetComponent<MatchManager>(); damageOverlayImage = GameObject.FindGameObjectWithTag("DamageOverlay").GetComponent<UI2DSprite>(); matchData = spaceship.GetComponent<SpaceshipMatchData>(); if (damageOverlayImage == null) { Debug.Log("No UI2DSprite tagged with 'DamageOverlay' was found in the scene!"); } Color indicatorColor = enemyIndicator.renderer.material.GetColor("_TintColor"); indicatorColor.a = 0.0f; enemyIndicator.renderer.material.SetColor("_Tint", indicatorColor); /* Make local copy of material so multiple of the same ships don't reference the same one. */ Material electricFieldCopy = Instantiate(electricField) as Material; electricField = electricFieldCopy; spaceshipShell.renderer.material = electricFieldCopy; spaceshipShell.GetComponent<ScrollUVLinear>().materialToScroll = electricFieldCopy; }
private static IEnumerator HandleSpawnWait(Spaceship spaceship) { SpaceshipMatchData matchData = spaceship.GetComponent <SpaceshipMatchData>(); SpaceshipControl controls = spaceship.GetComponent <SpaceshipControl>(); Collider collider = spaceship.GetComponent <Collider>(); matchData.spawnTimeRemaining = normalSpawnWait; spaceship.isVisible = false; spaceship.controlsEnabled = false; // instance.networkView.RPC("SetVisibility", RPCMode.All, false); // spaceship.spaceshipModelRoot.gameObject.SetActive(instance.isVisible); // controls.enabled = instance.isVisible; // collider.enabled = instance.isVisible; while (matchData.spawnTimeRemaining > 0.0f) { yield return(null); matchData.spawnTimeRemaining = Mathf.Max(0.0f, matchData.spawnTimeRemaining - Time.deltaTime); } spaceship.transform.position = spawnPoints[lastCheckpointID].transform.position; spaceship.transform.rotation = spawnPoints[lastCheckpointID].transform.rotation; // instance.networkView.RPC("SetVisibility", RPCMode.All, true); // spaceship.spaceshipModelRoot.gameObject.SetActive(instance.isVisible); // controls.enabled = instance.isVisible; // collider.enabled = instance.isVisible; SpaceshipHealth healthComponent = spaceship.GetComponent <SpaceshipHealth>(); healthComponent.currentHealth = healthComponent.maxHealth; spaceship.isVisible = true; spaceship.controlsEnabled = true; Debug.Log("Spawning '" + spaceship + "' at SpawnPoint " + lastCheckpointID + "!"); }
public override void Start() { base.Start(); currentHealth = maxHealth; matchManager = GameObject.FindGameObjectWithTag("MatchManager").GetComponent <MatchManager>(); damageOverlayImage = GameObject.FindGameObjectWithTag("DamageOverlay").GetComponent <UI2DSprite>(); matchData = spaceship.GetComponent <SpaceshipMatchData>(); if (damageOverlayImage == null) { Debug.Log("No UI2DSprite tagged with 'DamageOverlay' was found in the scene!"); } Color indicatorColor = enemyIndicator.renderer.material.GetColor("_TintColor"); indicatorColor.a = 0.0f; enemyIndicator.renderer.material.SetColor("_Tint", indicatorColor); /* Make local copy of material so multiple of the same ships don't reference the same one. */ Material electricFieldCopy = Instantiate(electricField) as Material; electricField = electricFieldCopy; spaceshipShell.renderer.material = electricFieldCopy; spaceshipShell.GetComponent <ScrollUVLinear>().materialToScroll = electricFieldCopy; }
// Update is called once per frame void Update () { if (matchData == null) { Spaceship ship = GameplayManager.spaceship; if (ship != null) { matchData = GameplayManager.spaceship.GetComponent<SpaceshipMatchData>(); spaceshipHealth = GameplayManager.spaceship.GetComponent<SpaceshipHealth>(); } } else { if (matchData.spawnTimeRemaining > 1.0f) { if (matchData.lastKilledBy == matchData.spaceship.gameObject) { label.text = string.Format("Suicide!\nRespawning in {0}...", (int)matchData.spawnTimeRemaining); } else { label.text = string.Format("{0} {1} by Player {2}!\nRespawning in {3}...", currentDeathAdjective, currentDeathVerb, (spaceshipHealth.lastHurtByPlayerID+1), (int)matchData.spawnTimeRemaining); } } else if (matchData.spawnTimeRemaining > 0.0f) { label.text = string.Format("Preparing for descent..."); UpdateDeathWords(); } else if (MatchManager.lastKilledPlayerId != -1) { if (MatchManager.lastKilledPlayerIdLastFrame != MatchManager.lastKilledPlayerId) { UpdateDeathWords(); } label.text = string.Format("{0} {1} Player {2}!", currentDeathAdjective, currentDeathVerb, (MatchManager.lastKilledPlayerId+1)); } else { label.text = ""; } } }
// Use this for initialization void Start () { label = GetComponent<UILabel>(); matchData = null; Random.seed = (int)(Time.time*313751); UpdateDeathWords(); }
// Use this for initialization void Start() { label = GetComponent <UILabel>(); currentLevel = LevelManager.GetLoadedLevel(); matchData = null; }
// Use this for initialization void Start () { label = GetComponent<UILabel>(); currentLevel = LevelManager.GetLoadedLevel(); matchData = null; }