private void Awake() { PlayerPrefs.SetInt("Highsocore", 0); life = 5; prfLife = life; Instance = this; }
void RayCasting() { RaycastHit2D hit = Physics2D.Raycast(sightStart.position, -Vector2.down); if (hit.collider != null) { GameControllerScript1.vidaDecrement(); Destroy(hit.collider.gameObject); } }
void RayCasting() { Debug.DrawLine(sightStart.position, sightEnd.position, Color.red); if (Physics2D.Linecast(sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer(tagOfObj)) && gameObject.tag == tagOfObj) { AudioSource.PlayClipAtPoint(clip, transform.position); GameControllerScript1.addScore(); Destroy(gameObject); } if (Physics2D.Linecast(sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer("Player"))) { GameControllerScript1.vidaDecrement(); Destroy(gameObject); } }
// Update is called once per frame void Update() { t += Time.deltaTime; if (shieldCoolDown < t) { shieldUp = false; t = 0; } PlayerInputs(); RayCasting(); if (Input.GetKeyDown(KeyCode.P)) { Debug.Log(qwe[0]); Debug.Log(qwe[1]); Debug.Log(qwe[2]); Debug.Log(df[0]); Debug.Log(df[1]); Debug.Log(GameControllerScript1.returnScore()); } }