private Vector3 offset; //Private variable to store the offset distance between the player and camera // Use this for initialization void Start() { //this.transform.localScale = new Vector3(1, 1, 1); //Calculate and store the offset value by getting the distance between the player's position and camera's position. // offset = transform.position - bossTr.transform.position; isBossScript = isBossScript.GetComponent <IA_Boss_01>(); }
// Update is called once per frame void Update() { if (this.transform.localPosition == new Vector3(transform.position.x, -3.8f, transform.position.z)) { particlesFallingOnGround.SetActive(true); } //----------------- if (_canInteract && fireActive) { bossFireFX.SetActive(true); iaBossScript.isStuned = true; iaBossScript.GetComponent <IA_Boss_01>().bossHealthPoints = 0; Debug.Log("Boss 01 DEFEATED"); } if (_canInteract) { iaBossScript.isStuned = true; } //-------------------------------------------------------- if (fireActive) { fireParticles.enableEmission = true; } else { fireParticles.enableEmission = false; } }
void OnTriggerStay2D(Collider2D other) { if (isBurning) { if (other.CompareTag("Boss") && iaBossScript.isStuned) { iaBossScript.GetComponent <IA_Boss_01>().bossHealthPoints = bossDammagesTakken; bossFireFX.SetActive(true); Debug.Log("BOSS TAKE DAMAGE"); //fireParticles.enableEmission = false; //fireFx.SetActive(false); } } }
// Update is called once per frame void Update() { if (GameObject.FindGameObjectWithTag("Player").GetComponent <SpriteRenderer>().sortingLayerName == "Platforms") { detectingPlayer = false; } Vector2 direction = new Vector2(1, 0); RaycastHit2D hit = Physics2D.Raycast(transform.position, direction * rayDir, distanceToSee); if (ia_boss_script.GetComponent <IA_Boss_01>().bossIsRight) { rayDir = 1; } else { rayDir = -1; } Debug.DrawRay(this.transform.position, direction * rayDir * distanceToSee, Color.magenta); if (Physics2D.Raycast(this.transform.position, direction * rayDir, distanceToSee)) { if (hit.collider != null) { if (hit.collider.tag == "Player") { if (GameObject.FindGameObjectWithTag("Player").GetComponent <SpriteRenderer>().sortingLayerName == "Player") { detectingPlayer = true; } //boss01_spr.color = Color.red; //playerDetected = true; //Debug.Log("Player touched"); } else { detectingPlayer = false; } } } else { boss01_spr.color = Color.white; //playerDetected = false; detectingPlayer = false; } }
// Use this for initialization void Start() { iaBoss01_script.GetComponent <IA_Boss_01>(); cameraBoundary_script.GetComponent <ProCamera2DNumericBoundaries>(); }