public bool switchActiveOnActivePaddle(PowerUps newPowerUp)
    {
        bool success = false;

        foreach (PowerUps powerup in playerData.paddles[playerData.activePaddle].runeIds)
        {
            if (skillDataList.getSkillData(powerup).isAnActive)
            {
                playerData.paddles[playerData.activePaddle].runeIds.Remove(powerup);

                print("removing current active: " + powerup);
                success = true;
                break;
            }
        }

        if (success)
        {
            if (!playerData.paddles[playerData.activePaddle].runeIds.Contains(newPowerUp))
            {
                playerData.paddles[playerData.activePaddle].runeIds.Add(newPowerUp);
                print("adding new active: " + newPowerUp);
            }
        }

        savePlayerDataAsync();

        return(success);
    }
示例#2
0
    public IEnumerator popIcons()
    {
        List <PowerUps> powerUps = MasterPlayerData.instance.getActivePaddle().runeIds;

        foreach (PowerUps item in powerUps)
        {
            Skill skill = skillDataList.getSkillData(item);
            if (skill != null)
            {
                print(skill.skillName);
                SkillUI ui = Instantiate(PowerUpsPrefab, transform).GetComponent <SkillUI>();
                ui.setSkillData(skill);
                skills.Add(ui);
                UnityAction <PowerUps, PowerUpState, float> listener = new UnityAction <PowerUps, PowerUpState, float>(updateState);
                listeners.Add(skill.powerUp.ToString(), listener);
                GameManage.StartListening(skill.powerUp.ToString(), listener);
                //StartCoroutine(turnOnOff(item));
            }

            yield return(new WaitForSeconds(0.1f));
        }
    }