void Start() { // Debug.Log("Init"); Weapon = GetComponent <W_Makarov>(); //GetComponent< GetComponent<W_Makarov>(); //Weapon = this.GetComponent<W_Makarov>(); //maxAmmo = Weapon.max_reserve; //ammoLeft = Weapon.cur_reserve; EnemyPov = GetComponentInParent <EnemyPOV>(); clipAmmo = Weapon.cur_clip; clipCapacity = Weapon.clip; fireRate = Weapon.fireRate; reloadRate = Weapon.t_reload; range = Weapon.range; spread = Weapon.spread; damage = Weapon.damage; Player = GameObject.FindGameObjectWithTag("Player"); PlayerHealth = Player.GetComponent <PlayerHealth>(); // Debug.Log("Init End"); source = GetComponents <AudioSource>(); lineRenderer = GetComponent <LineRenderer>(); gunEnd = Weapon.gunEnd; gunRay = transform.position; }
// Use this for initialization void Awake() { if (weapon != null) { player = GameObject.FindGameObjectWithTag("Player"); ep = GetComponent <EnemyPOV>(); enemyEquip(weapon); armed = true; } else { cur_clip = 0; armed = false; } }