public void Execute(GameObject go) { if (Tools.AreSimilar(Model.MajorColor, go.GetComponent <Renderer>().material.color)) { destroySound.Execute(); go.GetComponent <Walker>()?.PreDestroy(); Destroy(go); } }
public void Win() { winSound.Execute(); if (Model._tiles.FirstOrDefault() != null) { foreach (GameObject tile in Model._tiles) { tile.GetComponent <Renderer>().material.color = Color.green; } } }
void FixedUpdate() { Destination = UpdateMovement(gameObject, Destination); if (Destination == null) { rend.material.color = Color.black; getNoDestinationSound.Execute(); gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero; this.enabled = false; } }
public void PreDestroy() { var particles = Instantiate(partSys, transform.position, Quaternion.identity); var settings1 = particles.GetComponent <ParticleSystem>().main; var settings2 = particles.GetComponentInChildren <ParticleSystem>().main; settings1.startColor = rend.material.color; settings2.startColor = rend.material.color; //FRACTURE destructionSound.Execute(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); SoundEffect tgt = (SoundEffect)target; if (GUILayout.Button("Play Preview")) { if (_previewer == null) { _previewer = EditorUtility.CreateGameObjectWithHideFlags("Audio preview", HideFlags.HideAndDontSave, typeof(AudioSource)).GetComponent <AudioSource>(); } tgt.Execute(_previewer); } }
public void Execute(GameObject piece, GameObject tile) { Color pieceColor = piece.GetComponent <Renderer>().material.color; Color tileColor = tile.GetComponent <Renderer>().material.color; if (Tools.AreSimilar(pieceColor, tileColor)) { } else { piece.GetComponent <Renderer>().material.color = tileColor; tile.GetComponent <Renderer>().material.color = Color.black; arrivalSound.Execute(); } }
public void Lose() { if (Model._piecesAlive.Count == Model.BlackCount) { Debug.Log(Model._piecesAlive.Count.ToString() + Model.BlackCount.ToString()); lostSound.Execute(); Instantiate(lostParticles); foreach (GameObject tile in Model._tiles) { Destroy(tile); } foreach (GameObject piece in Model._piecesAlive) { Destroy(piece); } } }
public void Execute(Walker first, Walker second) { if (first != null && second != null && !HasJustCollided(first.gameObject, second.gameObject)) { if (second.rend.material.color == Color.black || first.rend.material.color == Color.black) { second.rend.material.color = Color.black; first.rend.material.color = Color.black; return; } var tempColor = second.rend.material.color; second.rend.material.color = first.rend.material.color; first.rend.material.color = tempColor; var tempDest = second.Destination; second.Destination = first.Destination; first.Destination = tempDest; collisionSound.Execute(); collisionHistory.Push(new KeyValuePair <string, string>(first.gameObject.name, second.gameObject.name)); } }