private void Start() { curPlayerHealth = 25.0f; tr = GetComponent <Transform>(); PlayerMove = GetComponent <PlayerMove>(); needRescue = transform.Find("FighterInterceptor").transform.Find("Fuselage").GetComponent <MeshRenderer>(); smoke = transform.Find("DestroySmoke").GetComponent <ParticleSystem>(); repairParticle = transform.Find("RepairParticle").GetComponent <ParticleSystem>(); fireEffect = transform.Find("FighterInterceptor").transform.Find("Fire_Effect").GetComponent <ParticleSystem>(); shotPos = transform.Find("ShotPos").gameObject; gameoverPanel = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas").transform.Find("GameOver").gameObject; hp_1 = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").transform.Find("HP_Panel").transform.Find("HP_1").gameObject; hp_2 = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").transform.Find("HP_Panel").transform.Find("HP_2").gameObject; hp_3 = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").transform.Find("HP_Panel").transform.Find("HP_3").gameObject; hp_4 = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").transform.Find("HP_Panel").transform.Find("HP_4").gameObject; hp_5 = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").transform.Find("HP_Panel").transform.Find("HP_5").gameObject; damageImage = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas").transform.Find("Damaged").gameObject; hpBar = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("Canvas_UI").gameObject; laser = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("[CameraRig]").gameObject; myaudio = GetComponent <AudioSource>(); boss_Health = GameObject.Find("Boss_position").transform.Find("BOSS").GetComponent <Boss_Health>(); clearCanv = GameObject.Find("CameraRig").transform.Find("Camera").transform.Find("ClearCanvas").gameObject; playerShot = GetComponent <PlayerShot>(); }
// Start is called before the first frame update void Start() { boss_targets.AddRange(GameObject.FindGameObjectsWithTag("Player")); if (boss_targets.Count == 1) { boss_targets.Add(GameObject.FindGameObjectWithTag("Player")); } anim = GetComponent <Animator>(); boss_Health = GetComponent <Boss_Health>(); boss_attack_center_up = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_center_up").GetComponent <Transform>(); boss_attack_center_right = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_center_right").GetComponent <Transform>(); boss_attack_center_left = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_center_left").GetComponent <Transform>(); boss_attack_center_down = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_center_down").GetComponent <Transform>(); boss_attack_right_center_1 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_right_center_1").GetComponent <Transform>(); boss_attack_right_center_2 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_right_center_2").GetComponent <Transform>(); boss_attack_right_center_3 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_right_center_3").GetComponent <Transform>(); boss_attack_right_front = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_right_front").GetComponent <Transform>(); boss_attack_left_center_1 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_left_center_1").GetComponent <Transform>(); boss_attack_left_center_2 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_left_center_2").GetComponent <Transform>(); boss_attack_left_center_3 = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_left_center_3").GetComponent <Transform>(); boss_attack_left_front = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_left_front").GetComponent <Transform>(); boss_attack_middle_center = transform.Find("BOSS_Attackplaces").transform.Find("boss_attack_middle_center").GetComponent <Transform>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Boss_Health boss_Health = GameObject.FindGameObjectWithTag("Boss").GetComponent <Boss_Health>(); boss_Health.TakeDamage(40); DataPlayerChange playerStam = collision.transform.GetComponent <DataPlayerChange>(); playerStam.UseStam(30); } }
void Awake() { // instans = this; PhotonNetwork.Instantiate("newPlayer", Vector3.zero, Quaternion.identity, 0, null); spawnMgr = GameObject.Find("SpawnMgr").gameObject; BOSS = GameObject.Find("Boss_position").transform.Find("BOSS").gameObject; boss_tr = GameObject.Find("Boss_position").GetComponent <Transform>(); spawnMgr.SetActive(false); BOSS.SetActive(false); bossAttack = BOSS.GetComponent <Boss_Attack>(); boss_Health = BOSS.GetComponent <Boss_Health>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Destroy(gameObject); throwclass.RemoveCooldown(); } if (collision.CompareTag("Ground")) { Instantiate(impact, transform.position, Quaternion.identity); rb.velocity = (GameObject.Find("Character").transform.position - transform.position).normalized * speed; } if (collision.tag.Equals("Boss")) { Boss_Health health = collision.GetComponent <Boss_Health>(); health.GetDamage(30, true, 5); } }
private void Awake() { shotLevel = 1; bombStock = 4; shotPos = transform.Find("ShotPos").gameObject; mainshotPos.GetComponent <PlayerFire>().enabled = true; subshotPos_a.GetComponent <PlayerSubFire>().enabled = false; subshotPos_b.GetComponent <PlayerSubFire>().enabled = false; subshotPos_a_2.GetComponent <PlayerSubFire>().enabled = false; subshotPos_b_2.GetComponent <PlayerSubFire>().enabled = false; Bomb = transform.Find("Bomb_Effect").GetComponent <ParticleSystem>(); boss_health = GameObject.Find("Boss_position").transform.Find("BOSS").GetComponent <Boss_Health>(); bomb_1 = transform.Find("FighterInterceptor").transform.Find("BombPos").transform.Find("BOMB_missile_1").gameObject; bomb_2 = transform.Find("FighterInterceptor").transform.Find("BombPos").transform.Find("BOMB_missile_2").gameObject; bomb_3 = transform.Find("FighterInterceptor").transform.Find("BombPos").transform.Find("BOMB_missile_3").gameObject; bomb_4 = transform.Find("FighterInterceptor").transform.Find("BombPos").transform.Find("BOMB_missile_4").gameObject; ShotBoom = GetComponent <AudioSource>(); playerMove = GetComponent <PlayerMove>(); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- // When the Game Starts private void Start() { nav = GetComponent <NavMeshAgent>(); bH = GetComponent <Boss_Health>(); camTarCon = GameObject.FindObjectOfType <CameraTargetController>(); rb = GetComponent <Rigidbody>(); rb.isKinematic = true; rb.mass = 9001; rb.constraints = RigidbodyConstraints.FreezeRotation; headHitBox.transform.GetComponent <Collider>().enabled = false; headHitBox.damage = burrowDamage; maxHealth = bH.health; if (wallTargetCount > 0) { //Example: //X = 1000 - (1000 / 3 + 1) //X = 1000 - 250 //X = 750 nextWallAttackSubstract = (maxHealth / (wallTargetCount + 1)); nextWallAttack = maxHealth - nextWallAttackSubstract; } }
void Start() { BossHealth = GameObject.Find("Boss_position").transform.Find("BOSS").GetComponent <Boss_Health>(); particle = this.transform.Find("missile_explosion").GetComponent <ParticleSystem>(); }
//This function is called when attacking private void Attack() { animator.SetTrigger("Attack"); if (grounded) { createDust(); // Creates dust particle when player swing sword only if player is on the ground } // This will create a circle that will detect a layer(which will be the enemy) // It takes as parameter a point, a radius and a layer and store the data received in an array(hitenemies) Collider2D[] hitenemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers); // For each data(we named it enemy here) that is in the array foreach (Collider2D enemy in hitenemies) { Monster_EnemyState enemy1 = enemy.GetComponent <Monster_EnemyState>(); // assigning a script's component in a variable if (enemy1 != null) // if this variable is not null then { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Reference to Knight_CameraShake script enemy1.EnemyTakeDamage(CommonEnemies); // Give damage to that layer by calling its damage function and giving it a parameter return; } Monster_Enemies enemy2 = enemy.GetComponent <Monster_Enemies>(); //assigning another script's component in a variable if (enemy2 != null) //if this variable is not null then { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Reference to Knight_CameraShake script enemy2.TakeDamage(HeavyEnemies); // Give damage to that layer by calling its damage function and giving it a parameter } Monster_Flying enemy3 = enemy.GetComponent <Monster_Flying>(); // Assigning another script's component in a variable if (enemy3 != null) // If this variable is not null then { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Activates Camera Shake from Knight_CameraShake script enemy3.TakeDamageFlyMonster(FlyingEnemies); // Give damage to that layer by calling its damage function and giving it a parameter } Boss_Health enemy4 = enemy.GetComponent <Boss_Health>(); if (enemy4 != null) { enemy4.MonsterTakeDamage(25); } Knight_Barrel Barrel = enemy.GetComponent <Knight_Barrel>(); if (Barrel != null) { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Activates Camera Shake from Knight_CameraShake script Barrel.BreakBarrel(xAmount, yAmount); // Breaks Barrel and spawn coins and hearts from Knight_Barrel script } Power_Chest Chest = enemy.GetComponent <Power_Chest>(); if (Chest != null) { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Activates Camera Shake from Knight_CameraShake script Chest.OpenChest(xAmount, yAmount); // Opens chest and spawn coins and hearts from Power_Chest script } Knight_Pot Pot = enemy.GetComponent <Knight_Pot>(); if (Pot != null) { camanimator.enabled = false; // Disable the Main Camera's Cinemachine Brain cam.enabled = false; // Disable the Main Camera's Animator Knight_CameraShake.instance.startShake(.1f, .2f); // Activates Camera Shake from Knight_CameraShake script Pot.BreakPot(xAmount, yAmount); // Breaks Barrel and spawn coins and hearts from Knight_Pot script } } }
/*too much of a hassle just hard code this *[Header("0 = genbu, 1 = snake genbu, 2 = Forgemaster, 3 = Disir")] * public string[] nameOfVictoryScenes;*/ /// <summary> /// Runs through all avalible objectives and updates weather or not they are completed. /// </summary> public void UpdateObjectives() { int numCompleted = 0; //Talles for checking if all objectives are finished for (int x = 0; x < _Objectives.Count; x++) { //Set the toggel to the same as the objectives complete bool. objectiveDisplay[x].isOn = _Objectives[x].bIsCompleted; //storage string string displayText; if (_Objectives[x].total > 0) { //Display the count and total. displayText = _Objectives[x].description + _Objectives[x].currentCount + "/" + _Objectives[x].total; } else { //Just show the objective. displayText = _Objectives[x].description; } //Assign the Display string for all to read. objectiveDisplay[x].GetComponentInChildren <Text>().text = displayText; } if (currentBoss == _Boss.Genbu) { //Talk to Objective system plate has fallen off for (int x = 0; x < _Objectives.Count; x++) { if (_Objectives[x].name == "broken legs") { ThighBlaster _blaster = GameObject.FindObjectOfType <ThighBlaster>(); _Objectives[x].currentCount = _blaster.numBroken; //set the count to that of the number of broken legs. // print("Numbroken: " + _Objectives[x].currentCount); if (_Objectives[x].currentCount == _Objectives[x].total) { _Objectives[x].bIsCompleted = true; } //Check to see if the goal is finished } else if (_Objectives[x].name == "armoured plating") { if (_Objectives[x].currentCount == _Objectives[x].total) { _Objectives[x].bIsCompleted = true; } //Check to see if the goal is finished } } } if (currentBoss == _Boss.Snake_Genbu) { //find the snake boss's health class Boss_Health _HP = FindObjectOfType <Boss_Health>(); //If the snake is dead set the objective completion to true if (_HP.health <= 0f) { _Objectives[0].bIsCompleted = true; } } foreach (ObjectiveData objective in _Objectives) { if (objective.bIsCompleted == true) { numCompleted++; //add a tick } } //when all the obectives are complete. if (numCompleted >= _Objectives.Count) { //load the next scene. //UnityEngine.SceneManagement.SceneManager.LoadScene(GetNextScene()); GameManager.GM.PlayerWon(currentBoss); } }