void Player_death() { if (player.activeSelf == false) { GameData.player_is_death = true; GameData.genetic_is_run = false; death_blackout.GetComponent <Grayscale>().enabled = true; //print("캐릭터 죽음"); //GameObject.FindWithTag("Enemy").GetComponent<Enemy_control>().enemy_hp = 0; //int spawn_enemy_now = GameData.enemy_many - Enemy_manager.enemy_spawn_num; int spawn_enemy_now = Enemy_manager.Receive_enemy_spawn_num(); //print("현재 적 NPC 스폰 수:" + spawn_enemy_now); for (int cnt = 0; cnt < spawn_enemy_now; cnt++) { //print(cnt + "번째 적 NPC 사망처리"); GameObject enemy_list = GameObject.Find("Enemy_spawn_list").transform.GetChild(cnt).gameObject; enemy_list.GetComponent <Enemy_control>().enemy_hp = 0; enemy_list.SetActive(false); } foreach (GameObject kill in kill_count_textmesh) { kill.GetComponent <TextMesh>().text = "Kill : " + GameData.kill_count.ToString(); } foreach (GameObject coin in stage_textmesh) { coin.GetComponent <TextMesh>().text = "Clear Stage : " + GameData.game_stage.ToString(); } gameover_UI.SetActive(true); } }
void Start() { player = FindObjectOfType <Player_movement>(); enemy = FindObjectOfType <Enemy_manager>(); thescoremanager = FindObjectOfType <Score_manager>(); }
void Bullet_effect_tag() { if (Physics.Raycast(transform.position, transform.forward, out hit, max_distance, ~ignore_layer)) { ray_num++; if (hit_wall_decal) { print("레이캐스트 : " + hit.transform.tag); //print("레이캐스트 갯수 : " + ray_num); if (hit.transform.tag == "Enemy") { Instantiate(blood_effect, hit.point, Quaternion.LookRotation(hit.normal)); hit.transform.gameObject.GetComponent <Enemy_control>().enemy_hp -= GameData.bullet_damage; Destroy(gameObject); } else if (hit.transform.tag == "Goto_market") { GameData.store_running = true; } else if (hit.transform.tag == "Next_stage") { GameData.is_next_stage = true; } else if (hit.transform.tag == "Uzi") { GameData.is_fire = false; GameData.buy_order_uzi = true; } else if (hit.transform.tag == "AK-47") { GameData.is_fire = false; GameData.buy_order_ak = true; } else if (hit.transform.tag == "Spase-12") { GameData.is_fire = false; GameData.buy_order_spase = true; } else if (hit.transform.tag == "Repair") { GameData.buy_order_repair = true; } else if (hit.transform.tag == "Upgrade") { if (ray_num < 2) { GameData.buy_order_upgrade = true; } } else if (hit.transform.tag == "Goto_main") { GameData.init(); Enemy_manager.ResetCreatures(); GameObject.FindWithTag("MainCamera").gameObject.GetComponent <Grayscale>().enabled = false; SceneManager.LoadScene("Start_Scene"); } else if (hit.transform.tag == "Retry") { GameData.init(); Enemy_manager.ResetCreatures(); GameObject.FindWithTag("MainCamera").gameObject.GetComponent <Grayscale>().enabled = false; SceneManager.LoadScene("Game_Scene"); } else if (hit.transform.tag == "Start") { //SceneManager.LoadScene("Game_Scene"); SceneManager.LoadScene("Game_Scene"); } else if (hit.transform.tag == "Exit") { print("종료"); Application.Quit(); } else if (hit.transform.tag == "Invirment" || hit.transform.tag == "Fence_up" || hit.transform.tag == "Fence_down" || hit.transform.tag == "Fence_right" || hit.transform.tag == "Fence_left") { Instantiate(hit_wall_decal, hit.point + hit.normal * infront_wall, Quaternion.LookRotation(hit.normal)); Destroy(gameObject); } } Destroy_bullet(); } Destroy_bullet(); }
void move() { print(index+" 번 적NPC의"+geneIndex+" 번 유전자"); int gene = Enemy_manager.GetGene(index, geneIndex); Quaternion spin_enemy = Quaternion.identity; //print("각도? : " + gene); switch (gene) { case 0: // 위쪽으로 60도 //spin_enemy.eulerAngles = new Vector3(0, 60, 0); transform.rotation = Quaternion.Euler(0f, 60f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; case 1: // 위쪽으로 40도 transform.rotation = Quaternion.Euler(0f, 40f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; case 2: // 위쪽으로 20도 transform.rotation = Quaternion.Euler(0f, 20f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; case 3: // 아래쪽으로 20도 transform.rotation = Quaternion.Euler(0f, -20f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; case 4: // 아래쪽으로 40도 transform.rotation = Quaternion.Euler(0f, -40f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; case 5: // 아래쪽으로 60도 transform.rotation = Quaternion.Euler(0f, -60f, 0f); StartCoroutine(Force_delay()); //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f); break; default: // 직진 transform.rotation = Quaternion.Euler(0f, 0f, 0f); break; } //GetComponent<Rigidbody>().AddForce(Vector3.forward * force_power, ForceMode.Impulse); //GetComponent<Rigidbody>().velocity = new Vector3(0f,0f,0f); //GetComponent<Rigidbody>().AddForce(Vector3.forward * 20, ForceMode.Force); //StartCoroutine(Force_move()); //this.transform.rotation = Quaternion.Slerp(transform.rotation, spin_enemy, Time.deltaTime * 0.1f); //this.transform.rotation = Quaternion.Euler(0,spin_enemy.eulerAngles.y, 0); //Rigidbody enemy_force = GetComponent<Rigidbody>(); //bodies.AddForce(Vector3.forward * 300, ForceMode.Impulse); //StartCoroutine(Force_move(spin_enemy)); geneIndex++; if (geneIndex > Enemy_manager.geneCount - 1) { geneIndex = 0; } }
void SetSelfIndex() // 지렁이 Creature form을 추가 { index = _count; _count++; Enemy_manager.AddCreature(this); }