Exemplo n.º 1
0
    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]);
    }
Exemplo n.º 2
0
 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++;
 }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
 public void setProjectileData(SOProjectile projectile)
 {
     projectileData = projectile;
     GetComponent <SpriteRenderer>().sprite = projectile.projectileArt;
 }
Exemplo n.º 5
0
 public void Initialize(SOProjectile data)
 {
     projectileData = data;
 }
Exemplo n.º 6
0
 public void refreshProjectileData(SOProjectile projectile)
 {
     getCurrentProjectile().GetComponent <ProjectileController>().setProjectileData(projectile);
 }
Exemplo n.º 7
0
 public void RefreshUi(SOProjectile projectile, int number)
 {
     projectileText.text    = $"{number} {projectile.projectileName} left";
     projectileImage.sprite = projectile.projectileArt;
 }