void Awake() { camera = GetComponent <Camera>(); material = GetComponentInChildren <Renderer>().sharedMaterial; instance = this; StartCoroutine(fadeIn()); }
void Update() { while (AllCells.Remove(null)) { } if (AllCells.Count < 1) { FadeCameraController.Lose(); Destroy(this); return; } var mousePos = getMouseWorldPos(); if (Input.GetMouseButtonDown(0)) { cachedSelection.Clear(); if (Input.GetKey(KeyCode.LeftShift)) { cachedSelection.AddRange(selectedCells); } selectoid = (Instantiate(selectoidPrefab, null) as GameObject).GetComponent <SelectoidController>(); selectionPtA = mousePos; } if (Input.GetMouseButton(0)) { selectionPtB = mousePos; selectoid.transform.position = (selectionPtA + selectionPtB) / 2f; selectoid.SetSize((selectionPtB - selectionPtA).Abs()); updateSelection(); } if (Input.GetMouseButtonUp(0)) { Destroy(selectoid.gameObject); selectoid = null; } if (shouldUpdateSelectedCells || Input.GetMouseButtonDown(1)) { shouldUpdateSelectedCells = false; updateAttractionListInAllCells(); } if (Input.GetMouseButton(1)) { updateSeekPointInSelectedCells(mousePos); } if (Input.GetKey(KeyCode.Space)) { ApoptosisSelection(); } updateCameraPosition(); }
public void GetRekt() { Audio.Play("Success"); Destroy(gameObject); FadeCameraController.Win(); }