// Use this for initialization void Awake() { p = GameObject.FindGameObjectWithTag("GameManager").GetComponent <ShipInventory>(); if (p.GetFuelTankState() == 0 && fuel.sprite != red) { fuel.sprite = red; } else if (p.GetFuelTankState() == 1 && fuel.sprite != green) { fuel.sprite = green; } if (p.GetOxygenTankState() == 0 && oxygen.sprite != red) { oxygen.sprite = red; } else if (p.GetOxygenTankState() == 1 && oxygen.sprite != green) { oxygen.sprite = green; } if (p.GetScannerState() == 0 && scanner.sprite != red) { scanner.sprite = red; } else if (p.GetScannerState() == 1 && scanner.sprite != green) { scanner.sprite = green; } }
public void Refresh() { if (p.GetFuelTankState() == 0 && fuel.sprite != red) { fuel.sprite = red; } else if (p.GetFuelTankState() == 1 && fuel.sprite != green) { fuel.sprite = green; } if (p.GetOxygenTankState() == 0 && oxygen.sprite != red) { oxygen.sprite = red; } else if (p.GetOxygenTankState() == 1 && oxygen.sprite != green) { oxygen.sprite = green; } if (p.GetScannerState() == 0 && scanner.sprite != red) { scanner.sprite = red; } else if (p.GetScannerState() == 1 && scanner.sprite != green) { scanner.sprite = green; } }
public void UpdateLights() { if (p.GetFuelTankState() == 0 && FuelSlot.GetComponent <SpriteRenderer>().sprite != red) { FuelSlot.GetComponent <SpriteRenderer>().sprite = red; } else if (p.GetFuelTankState() == 1 && FuelSlot.GetComponent <SpriteRenderer>().sprite != green) { FuelSlot.GetComponent <SpriteRenderer>().sprite = green; } if (p.GetOxygenTankState() == 0 && OxygenSlot.GetComponent <SpriteRenderer>().sprite != red) { OxygenSlot.GetComponent <SpriteRenderer>().sprite = red; } else if (p.GetOxygenTankState() == 1 && OxygenSlot.GetComponent <SpriteRenderer>().sprite != green) { OxygenSlot.GetComponent <SpriteRenderer>().sprite = green; } if (p.GetScannerState() == 0 && ScannerSlot.GetComponent <SpriteRenderer>().sprite != red) { ScannerSlot.GetComponent <SpriteRenderer>().sprite = red; } else if (p.GetScannerState() == 1 && ScannerSlot.GetComponent <SpriteRenderer>().sprite != green) { ScannerSlot.GetComponent <SpriteRenderer>().sprite = green; } if (p.GetScannerState() == 0 || p.GetOxygenTankState() == 0 || p.GetFuelTankState() == 0) { display.text = "Ouch ! Il semblerait qu'au moins un de vos appareils soit endommagé !"; } else { display.text = "Il n'y a eu aucun soucis durant le voyage jusqu'à cette étoile."; } }
// Use this for initialization void Awake() { GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager"); if (gameManager != null) { param = gameManager.GetComponent <Parameters>(); if (param != null) { seedPlanets = param.getAllSeedsSystem(); //Recupere les seeds des planetes du systèmes for (int i = 0; i < seedPlanets.Count; i++) //Positionne chaque planètes sur le tableau de bord { Vector3 pos = new Vector3(xMin + (i / (float)seedPlanets.Count) * (xMax - xMin), y, 0); GameObject temp = Instantiate(planetPrefab, pos, Quaternion.identity); temp.GetComponent <Spaceship_Planet>().setIndexPlanet(i); //Pour que chaque planète connaise son index au sein du système temp.GetComponent <Spaceship_Planet>().setSeed(seedPlanets[i]); if (param.planetSpritesIndexes[param.currentSystem][i] == -1) { var index = Random.Range(0, allSprites.Count); param.planetSpritesIndexes[param.currentSystem][i] = index; temp.GetComponent <SpriteRenderer>().sprite = allSprites[index]; } else { temp.GetComponent <SpriteRenderer>().sprite = allSprites[param.planetSpritesIndexes[param.currentSystem][i]]; } } } if (param.comeFromGazeuse) { param.comeFromGazeuse = false; gazeuseWindows.SetActive(true); ShipInventory s = param.gameObject.GetComponent <ShipInventory>(); var de = param.getRandomInt(0, 3); if (de == 0 && s.GetScannerState() == 1) { s.SetScannerState(0); } else if (de == 1 && s.GetFuelTankState() == 1) { s.SetFuelTankState(0); } else if (de == 2 && s.GetOxygenTankState() == 1) { s.SetOxygenTankState(0); } } } refreshLeds.Refresh(); }
public void checkProbaBreak() { float O, F, S; O = p.getRandomInt(0, 100); // Oxygen F = p.getRandomInt(0, 100); // Fuel S = p.getRandomInt(0, 100); // Scanner if (O < probaOxy) { if (SI.GetOxygenTankState() == 1) { SI.SetOxygenTankState(0); OxyBreak.start(); } } else if (F < probaFuel) { if (SI.GetFuelTankState() == 1) { SI.SetFuelTankState(0); FuelBreak.start(); } } else if (S < probaScan) { if (SI.GetScannerState() == 1) { SI.SetScannerState(0); ScanBreak.start(); } } // OxyBreak.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); // FuelBreak.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); // ScanBreak.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); }