Exemplo n.º 1
0
 public PaddleLogic(IPositionAdapter positionAdapter, PaddleData paddleData, PaddleInput paddleInput, PaddleSimulation paddleSimulation)
 {
     this.positionAdapter  = positionAdapter;
     this.paddleData       = paddleData;
     this.paddleInput      = paddleInput;
     this.paddleSimulation = paddleSimulation;
 }
Exemplo n.º 2
0
    private void Start()
    {
        paddle = new PaddleData();

        sr = GetComponent <SpriteRenderer>();
        paddle.ColorMode = 0;
        Debug.Log("paddle initialized");
    }
    public PaddleData addPaddle()
    {
        PaddleData newPaddle = new PaddleData();

        playerData.paddles[getNextPaddleId()] = newPaddle;
        setActivePaddle(newPaddle);

        savePlayerDataAsync();


        return(newPaddle);
    }
    public void setActivePaddle(PaddleData paddleData)
    {
        foreach (int id in playerData.paddles.Keys)
        {
            if (playerData.paddles[id] == paddleData)
            {
                playerData.activePaddle = id;
                return;
            }
        }

        savePlayerDataAsync();
    }
    public void loadData(PaddleData data)
    {
        if (data.branchesPurchased.Count > 0)
        {
            biomeLeft.color = DataTypes.GetButtonColorFrom(data.branchesPurchased[0]);
            left            = data.branchesPurchased[0];
        }
        else
        {
            biomeLeft.color = Color.white;
        }

        if (data.branchesPurchased.Count > 1)
        {
            biomeRight.color = DataTypes.GetButtonColorFrom(data.branchesPurchased[1]);
            right            = data.branchesPurchased[1];
        }
        else
        {
            biomeRight.color = Color.white;
        }

        int leftIndex  = 0;
        int rightIndex = 0;

        foreach (PowerUps powerUp in data.runeIds)
        {
            print("powerup: " + powerUp);
            Skill skill = MasterPlayerData.instance.skillDataList.getSkillData(powerUp);
            if (skill.biome == left)
            {
                if (leftIndex == 0)
                {
                    left1.sprite  = skill.icon;
                    left1.enabled = true;
                }
                else if (leftIndex == 1)
                {
                    left2.sprite  = skill.icon;
                    left2.enabled = true;
                }
                else if (leftIndex == 2)
                {
                    left3.sprite  = skill.icon;
                    left3.enabled = true;
                }

                leftIndex++;
            }
            else
            {
                if (rightIndex == 0)
                {
                    right1.sprite  = skill.icon;
                    right1.enabled = true;
                }
                else if (rightIndex == 1)
                {
                    right2.sprite  = skill.icon;
                    right2.enabled = true;
                }
                else if (rightIndex == 2)
                {
                    right3.sprite  = skill.icon;
                    right3.enabled = true;
                }

                rightIndex++;
            }
        }
    }
    public void updatePaddle(int paddleId, PaddleData paddleData)
    {
        playerData.paddles[paddleId] = paddleData;

        savePlayerDataAsync();
    }