Esempio n. 1
0
    /// <summary>
    /// Load the skill data from the serialized object and
    /// reapply the loaded data to the active player.
    /// </summary>
    /// <param name="serializedObj">object with the player's saved data</param>
    public override void Load(object serializedObj)
    {
        SkillSaveData data = serializedObj as SkillSaveData;

        // Give the player their unlocked skills and unlocked skill states back
        // Shapes
        int[] shapeStates = data.GetShapeUnlockStates();
        UnlockSkillStatesForPlayer(SkillController.SkillEnum.Shape, shapeStates);
        // Colors
        int[] colorStates = data.GetColorUnlockStates();
        UnlockSkillStatesForPlayer(SkillController.SkillEnum.Color, colorStates);
        // Set the active states without using the skills
        SkillBase <ShapeData> shapeSkill = skillController.GetSkill(SkillController.SkillEnum.Shape) as SkillBase <ShapeData>;
        SkillBase <ColorData> colorSkill = skillController.GetSkill(SkillController.SkillEnum.Color) as SkillBase <ColorData>;

        shapeSkill.FakeUse(data.GetActiveShapeState());
        colorSkill.FakeUse(data.GetActiveColorState());
        // Set the shape size
        scaleController.ShapeScale = data.GetShapeSize();
    }