Пример #1
0
    public void QuickLoad()
    {
        isLoading = true;
        string[] lines = File.ReadAllLines(FILE_PATH);
        MPTGameManager.Instance.score = int.Parse(lines[0]);
        MPTGameManager.Instance.UpdateScoreText();

        for (int lineId = 1; lineId < lines.Length; ++lineId)
        {
            string[] split = lines[lineId].Split(':');
            if (split.Length < 4)
            {
                continue;
            }

            string  shapeName = split[0];
            Vector3 pos       = new Vector3(float.Parse(split[1]), float.Parse(split[2]), float.Parse(split[3]));
            int     points    = int.Parse(split[4]);

            GameObject newShapeGo = MPTSpawner.Instance.CreateShapeInQueue(MPTSpawner.Instance.spawnablesDict[shapeName]);


            MPTShape newShape = newShapeGo.GetComponent <MPTShape>();
            newShape.points = points;
            newShape.UpdateColor();

            if (pos.y != MPTSpawner.Instance.spawnPoints[0].transform.position.y)
            {
                newShapeGo.transform.position = pos;
                MPTDraggable draggable = newShapeGo.GetComponent <MPTDraggable>();
                draggable.initialPos          = new Vector3(-1000.0f, -1000.0f, 0.0f);
                newShape.canDrop              = true;
                newShape.transform.localScale = newShape.initialScale;
                newShape.AfterDrop();
            }
        }
        MPTSpawner.Instance.UpdateDropWarning();
        isLoading = false;
    }
Пример #2
0
 void Awake()
 {
     draggable = GetComponent <MPTDraggable>();
 }