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