コード例 #1
0
ファイル: MapPlatform.cs プロジェクト: Mathux/tim-dodge
 /// <summary>
 /// Load a platform from a saved version
 /// </summary>
 /// <param name="sp">A saved platform </param>
 /// <returns>A map platform (a real one)</returns>
 public static MapPlatform LoadPlatform(SavePlatform sp)
 {
     PlatformObject[] objs = new PlatformObject[sp.platform.Length];
     for (int i = 0; i < objs.Length; i++)
     {
         objs[i] = PlatformObject.LoadBlock(sp.platform[i]);
     }
     return(new MapPlatform(objs, sp.x_offset, sp.y_offset));
 }
コード例 #2
0
 public SavePlatforms(GameObject[] inplatforms)
 {
     platforms = new SavePlatform[inplatforms.Length];
     for (int i = 0; i < inplatforms.Length; i++)
     {
         GameObject jeff = inplatforms[i];
         platforms[i] = new SavePlatform(jeff.transform.position.x, jeff.GetComponent <PlatformUpgrader>().currentlevel); //mabey - 1?
     }
 }
コード例 #3
0
    public override void Init(GlobalController controller)
    {
        base.Init(controller);

        //Get all attached platforms, sets current platform and removes all other platforms
        SavePlatform[] platforms = GetComponentsInChildren <SavePlatform>();
        for (int i = 0; i < platforms.Length; i++)
        {
            if (Application.platform.HasFlag(platforms[i].GetPlatform()))
            {
                currentSavePlatform = platforms[i];
                RemoveOtherPlatforms(platforms, Application.platform);
                platforms = null;
                break;
            }
        }

        currentSavePlatform.Init(this);
    }