public void PermanentSetUpFirePoint(FirePoint firePoint) { firePoint.CreateFirePointsDictionaries(); for (int i = 0; i < gunsConfigurations.Length; i++) { if (gunsConfigurations[i].gunType == GameEnums.Gun.None) { continue; } if (firePoint.GunPointsDictionary.ContainsKey(gunsConfigurations[i].locationPath.ToString())) { GameObject gun = ObjectPoolersHolder.GunsPooler.PermanentSpawn(gunsConfigurations[i].gunType.ToString()); FirePoint.GunPoint gunPoint = firePoint.GunPointsDictionary[gunsConfigurations[i].locationPath.ToString()]; gun.transform.parent = gunPoint.gunsLocation; gun.transform.localPosition = Vector3.zero; Gun gunComponent = gun.GetComponent <Gun>(); gunComponent.battleType = gunsConfigurations[i].battleType; gunComponent.SetAnglesData(null); gunComponent.SetAnglesData(gunPoint.allowableAnglesOnPoint); gunComponent.SetGunData(gunsConfigurations[i].gunDataType); firePoint.TrackingGroupsDictionary[gunsConfigurations[i].trackingGroup].Add(gunComponent); } } }
public void StartListeningGunPoint(FirePoint.GunPoint gunPoint) { this.gunPoint = gunPoint; gameObject.GetComponent <Button>().onClick.AddListener(() => SelectGun()); }