public void nextProjectile() { bool switched = false; int iterations = 0; while (!switched || iterations > levelProjectilesData.Count) { if (currentIndex >= projectileTypes.Count) { currentIndex = 0; } if (levelProjectiles[projectileTypes[currentIndex]] > 0) { currentProjectile = projectileTypes[currentIndex]; switched = true; } currentIndex++; iterations++; print("iteration " + iterations); if (iterations > 100) { break; } } //PlayerMotor.instance.refreshProjectileData(currentProjectile); if (!switched) { GameEvents.instance.failed(); } PlayerMotor.instance.getCurrentProjectile().GetComponent <ProjectileController>().setProjectileData(currentProjectile); UiManager.instance.RefreshUi(currentProjectile, levelProjectiles[currentProjectile]); }
void initializeProjectileDict() { for (int i = 0; i < levelProjectilesData.Count; i++) { levelProjectiles.Add(levelProjectilesData[i].projectile, levelProjectilesData[i].number); projectileTypes.Add(levelProjectilesData[i].projectile); } currentProjectile = projectileTypes[0]; currentIndex++; }
public void Initialize(int newTeam, float speed, Vector3 right, SOProjectile projectile, ITargetable newTarget) { initialSpeed = speed; projectileData = projectile; target = newTarget; team = newTeam; accumulatedSpeed = initialSpeed; gameObject.layer = LayerMask.NameToLayer(team.ToString()); GetComponent <SetMaterialProperties>().SetMaterial(0f, TeamColors.Hues[team], projectileData.sprite); }
public void setProjectileData(SOProjectile projectile) { projectileData = projectile; GetComponent <SpriteRenderer>().sprite = projectile.projectileArt; }
public void Initialize(SOProjectile data) { projectileData = data; }
public void refreshProjectileData(SOProjectile projectile) { getCurrentProjectile().GetComponent <ProjectileController>().setProjectileData(projectile); }
public void RefreshUi(SOProjectile projectile, int number) { projectileText.text = $"{number} {projectile.projectileName} left"; projectileImage.sprite = projectile.projectileArt; }