// Update is called once per frame void Update () { if (hud == null) { if (GameObject.FindGameObjectsWithTag("HUD") != null) { hud = GameObject.FindGameObjectWithTag("HUD").GetComponent<hudHandler>(); } } if (hud.getInvincible ()) { this.renderer.enabled = true; } else { this.renderer.enabled = false; } }
// Update is called once per frame void Update () { if (ouch.activeInHierarchy == true && Time.time > lastHitTime + 0.3f) { ouch.SetActive(false); } if (hud == null) { if (GameObject.FindGameObjectsWithTag("HUD") != null) { hud = GameObject.FindGameObjectWithTag("HUD").GetComponent<hudHandler>(); } } if (hud.getInvincible ()) { capsule.radius = 1.6f; } else { capsule.radius = 0.4f; } if (!lowLife && hud.getHealth() <= 20) { battement.Play(); lowLife = true; } if (hud.getHealth() > 20 || hud.getHealth()<=0) { battement.Stop(); lowLife = false; } }
void inputChoiceWindow(int windowID) { GUILayout.Space(15); if (iWantToPlayWithAndroid == false && iWantToPlayWithoutAndroid == false) { GUILayout.Label("Bienvenue dans Space Samourai"); GUILayout.Label("Choisissez comment vous voulez jouer"); GUILayout.Space(15); if (GUILayout.Button("Jouer avec Android", GUILayout.Height(buttonHeight))) { iWantToPlayWithAndroid = true; server = (GameObject)Instantiate(server); } GUILayout.Space(10); if (GUILayout.Button("Jouer sans Android", GUILayout.Height(buttonHeight))) { iWantToPlayWithoutAndroid = true; launched = true; currentGame = (GameObject)Instantiate(game); Time.timeScale = 1f; myHudHandler = GameObject.FindGameObjectWithTag ("HUD").GetComponent<hudHandler>(); // on instancie le jeu; } } if (iWantToPlayWithAndroid == true) { if (connected == true) { data = server.GetComponent<ServerHandler>().getData(); if (data.go == true) { if (!launched) { // on lance le jeu avec android launched = true; currentGame = (GameObject)Instantiate(game); Time.timeScale = 1f; myHudHandler = GameObject.FindGameObjectWithTag ("HUD").GetComponent<hudHandler>(); } } else { GUILayout.Label(" Vous etes connecté, cliquer pour commencer "); } } else { GUILayout.Label(" Connectez vous à l'adresse IP : " + adresseIP + " sur le port 3000"); } } }
// Use this for initialization void Start () { hud = GameObject.FindGameObjectWithTag("HUD").GetComponent<hudHandler>(); myBody = transform.Find ("ninjeuboom").gameObject; }