void Start() { att_man = GetComponent <attack_manager>(); zb_manager = GetComponent <zombie_manager>(); cc = GetComponent <CharacterController>(); seeker = GetComponent <Seeker>(); }
void shoot() { Vector3 direction = wp_obj.transform.forward; Ray ray = new Ray(wp_obj.transform.position, direction); RaycastHit result; weapon current_weapon = weapons[index]; if (Physics.Raycast(ray, out result, current_weapon.range)) { if (result.collider.gameObject.CompareTag("Zombie")) { zombie_manager zb_manager = result.collider.gameObject.GetComponent <zombie_manager>(); if (zb_manager.deal_damages(weapons[index].damages)) { dc.st.add_points(zb_manager.stats.diffuculty * 10); } else { dc.st.add_points(1); } dc.ui.refresh_points(); } Debug.Log("touché"); draw_shot(wp_obj.transform.position, result.point); } else { draw_shot(wp_obj.transform.position, wp_obj.transform.position + wp_obj.transform.forward * 100); } current_weapon.clip_ammo--; dc.ui.refresh_weapon(); }
void Start() { db = GameObject.Find("Database").GetComponent <game_data_base>(); zombie_manager tmp = GetComponent <zombie_manager>(); ref_zombie = tmp.stats; target = get_target(); }