void Awake() { Instance = this; //Camera cam = FindObjectOfType<Camera>(); originalCamSize = shakeCam.orthographicSize; originalCamPos = shakeCam.transform.position; }
void Awake() { SoundM = FindObjectOfType <SoundManager>(); CameShakeM = FindObjectOfType <CamShakeManager>(); rigidBody = gameObject.GetComponent <Rigidbody2D>(); MyLCP = GetComponentInParent <LocalPlayerController>(); MaxPlayerSpeed = MyLCP.WidthMultiplier * MyLCP.MaxHorizontalSpeed; }
void MakeBumpEffect(Vector2 cPoint) { SoundManager.play_crash(); CamShakeManager.PlayShake(0.2f, 0.2f); Vector3 spawnPos = UtilityScript.transformToCartesian(new Vector3(cPoint.x, cPoint.y, 0.0f)); GameObject bumpMaker = Instantiate(bumpEffect, spawnPos, Quaternion.identity) as GameObject; bumpMaker.transform.SetParent(meshTransform); }
public void DestroyObject() { GameObject ee = Instantiate(ExplosionEffect, mesh.transform.position, Quaternion.identity) as GameObject; ee.transform.SetParent(GameManager.GMInstance.root.transform); gameObject.SetActive(false); GameManager.GMInstance.PlayerDied(gameObject); cameraLoc.updatePlayers = true; CamShakeManager.PlayShake(0.5f, 1); SoundManager.play_death(); }
//LUKA public void DestroySegment(Vector3 explodePosition) { if (!isDestroyed) { isDestroyed = true; GameObject explosionInstance = Instantiate(ExplosionEffect, explodePosition, Quaternion.identity) as GameObject; CamShakeManager.PlayShake(0.1f, 0.5f); mesh.transform.GetChild(0).gameObject.SetActive(false); explosionInstance.transform.SetParent(mesh.transform); gameObject.GetComponent <BoxCollider2D> ().enabled = false; SoundManager.play_segment_destroyed(); } }
void SegmentTriggerBehaviour.Enter(Collider2D other, SegmentController segmentController) { if (other.gameObject.tag == "Shot" || other.gameObject.tag == "PiercingShot" || other.gameObject.tag == "StarPulse") { Vector3 explodePosition = UtilityScript.transformToCartesian(other.transform.position); GameObject explosionInstance = MonoBehaviour.Instantiate(segmentController.shotFart, explodePosition, Quaternion.identity) as GameObject; CamShakeManager.PlayShake(0.1f, 0.5f); //SoundManager.PlayExplosionClip(); // segmentController.mesh.transform.GetChild(0).gameObject.SetActive(false); explosionInstance.transform.SetParent(segmentController.mesh.transform); } }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (timer > duration) { int noOfBlasts = Random.Range(minNoOfBlasts, maxNoOfBlasts + 1); CamShakeManager.PlayShake(0.5f, noOfBlasts * 0.5f); for (int i = 0; i < noOfBlasts; i++) { GameObject starPulse = MonoBehaviour.Instantiate(starPulseBlast, physics.transform.position, new Quaternion()) as GameObject; } Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D col) { if (!IsUsed) { if (col.gameObject.tag == "Shot") { CamShakeManager.PlayShake(0.1f, 0.1f); IsUsed = true; if (col != null) { if (col.gameObject != null) { //Destroy(col.gameObject.transform.root.gameObject); } } //ExplosionEffect = Resources.Load ("_new/ExplosionEffect") as GameObject; if (ExplosionEffect != null && ShotTransform != null) { GameObject ee = Instantiate(ExplosionEffect, ShotTransform.position, Quaternion.identity) as GameObject; ee.transform.SetParent(GameManager.GMInstance.root.transform); } if (transform.root.gameObject != null) { Destroy(root.gameObject); } } } if (col.gameObject.tag == "Boundary") { Destroy(root.gameObject); } if (col.gameObject.tag == "Segment" && gameObject.tag != "PiercingShot") { if (transform.root.gameObject != null) { MonoBehaviour.Destroy(root.gameObject); } } }
// Use this for initialization void Awake() { CamShakeM = FindObjectOfType <CamShakeManager> (); }