void Start() { var mapGenerator = GetComponent <MapGenerator>(); blockRenderer = GetComponent <BlockRenderer>(); stats = GetComponent <PlayerStatistics>(); spawnSerializer = GetComponent <SpawnSerializer>(); canvasController = GetComponent <GameCanvasController>(); sounds = GetComponent <SoundController>(); map = mapGenerator.Generate(90, 90); Func <Spawn, VectorI2> GetStart = (s) => { int rndId = UnityEngine.Random.Range(0, s.spawnPoints.Count); SpawnPoint sp = s.spawnPoints[rndId]; var vec = new VectorI2((int)sp.playerSpawn.x, (int)sp.playerSpawn.y); map[vec.X, vec.Y] = Constants.Objects.Floor; var vecRadio = new VectorI2((int)sp.radioSpawn.x, (int)sp.radioSpawn.y); map[vecRadio.X, vecRadio.Y] = Constants.Objects.Radio; return(vec); }; playerPos = GetStart(spawnSerializer.GetSpawn()); blockRenderer.Initialize(SquareIsValid, map, playerPos.X, playerPos.Y); StartCoroutine(ReduceOxygen()); StartCoroutine(RunDownRadio()); }
private void Awake() { if (instance == null) { instance = this; } }
private void Awake() { if (sInstance != null && sInstance != this) { Destroy(sInstance); } sInstance = this; }
public LevelState(PreparedLevel preparedLevel, GameManager gameManager) { receivedPreparedLevel = preparedLevel; levelObjectInstance = preparedLevel.PreparedLevelGOInstance.GetComponent <LevelObject>(); this.gameManager = gameManager; cameraManager = gameManager.cameraManager; ballThrowableManager = gameManager.ballThrowableManager; GameCanvasController = gameManager.gameCanvasController; }
// Use this for initialization void Start() { if (GCC == null) { GCC = this; } else { Destroy(this); } timeManager = TimeManager.Instance; }
// Update is called once per frame void Update() { float rotrange = MaxAngle - MinAngle; float rpm = (c.player.v.RPM / MaxRPM); float changeRate = (Mathf.Clamp(c.player.v.RPM, 0, 7000) - oldrpm) / Time.deltaTime; oldrpm = Mathf.Clamp(c.player.v.RPM, 0, 7000); ChangeRate = Mathf.Lerp(ChangeRate, changeRate, Time.deltaTime * 10f); if (invert) { rpm = 1 - rpm; } rpm = Mathf.Clamp01(rpm); transform.rotation = Quaternion.Euler(0, 0, rpm * rotrange + MinAngle); float blurval = 0; if (Mathf.Abs(ChangeRate) > 1600) { blurval = (Mathf.Abs(ChangeRate) - 1600) / 8000; } blurval = Mathf.Abs(blurval); for (int i = 0; i < BlurP.Length; i++) { BlurP[i].rectTransform.localRotation = Quaternion.Euler(0, 0, blurval * (i + 1 / (float)BlurP.Length)); BlurN[i].rectTransform.localRotation = Quaternion.Euler(0, 0, -blurval * (i + 1 / (float)BlurP.Length)); Color c = new Color(1, 1, 1, (1 - (i / (float)BlurP.Length)) / (blurval * 16)); if (rpm < 0.25f) { c = new Color(1, 0, 0, (1 - (i / (float)BlurP.Length)) / (blurval * 16)); } BlurP[i].color = c; BlurN[i].color = c; } GetComponent <Image>().color = new Color(1, 1, 1, 1 / (blurval * 48)); if (rpm < 0.25f) { GetComponent <Image>().color = new Color(1, 0, 0, 1 / (blurval * 48)); } }
private void Awake() { gameCanvasController = GameCanvas.GetComponent <GameCanvasController>(); gameOverCanvasController = GameOverCanvas.GetComponent <GameOverCanvasController>(); dictionary = new Dictionary <GameObject, List <GameMode.eMode> >() { { TitleCanvas, new List <GameMode.eMode>() { GameMode.eMode.Title } }, { GameCanvas, new List <GameMode.eMode>() { GameMode.eMode.Game, GameMode.eMode.Tutorial, GameMode.eMode.Pause } }, { GameOverCanvas, new List <GameMode.eMode>() { GameMode.eMode.GameOver, GameMode.eMode.Credits } }, }; }
/// <summary> /// Used to initialise the singleton World object /// </summary> internal void Awaken() { if (Instance != null) { return; } Instance = this; _kernel = Flow.Create.NewKernel(); _player = FindObjectOfType <Player>(); GameCanvas = FindObjectOfType <GameCanvasController>(); _gateManager = FindObjectOfType <GateManager>(); _game = FindObjectOfType <Game>(); // TODO: combine scenes _loaded = true; ActivateGame(false); }
void Start() { instance = this; }
// Start is called before the first frame update void Start() { c = GetComponentInParent <GameCanvasController>(); text = GetComponentInChildren <Text>(); }
void Awake() { Instance = this; gameObject.SetActive(true); }
// Start is called before the first frame update void Start() { text = GetComponent <Text>(); c = GetComponentInParent <GameCanvasController>(); v = c.player.v; }
public void OnBossSpawned() { GameCanvasController.GetInstance().OnBossAppeared(); }
private IEnumerator VictoryAfterDelay() { yield return(new WaitForSeconds(1f)); GameCanvasController.GetInstance().OnVictory(); }
void Start() { c = GetComponentInParent <GameCanvasController>(); oldrpm = c.player.v.RPM; }
/// <summary> /// Used to initialise the singleton World object /// </summary> internal void Awaken() { if (Instance != null) return; Instance = this; _kernel = Flow.Create.NewKernel(); _player = FindObjectOfType<Player>(); GameCanvas = FindObjectOfType<GameCanvasController>(); _gateManager = FindObjectOfType<GateManager>(); _game = FindObjectOfType<Game>(); // TODO: combine scenes _loaded = true; ActivateGame(false); }