Exemplo n.º 1
0
    private void Generate()
    {
        InitBounds();
        List <MapLevel> levels = GenerateLevels();

        Assets.Plugins.SmartLevelsMap.Scripts.Path path = GeneratePath(levels);
        _levelsMap.WaypointsMover = GenerateCharacter(path);
        _levelsMap.WaypointsMover.transform.position = levels [0].transform.position;
    }
Exemplo n.º 2
0
 protected void UpdatePathWaypoints(List <MapLevel> mapLevels)
 {
     Assets.Plugins.SmartLevelsMap.Scripts.Path path = FindObjectOfType <Assets.Plugins.SmartLevelsMap.Scripts.Path>();
     path.Waypoints.Clear();
     foreach (MapLevel mapLevel in mapLevels)
     {
         path.Waypoints.Add(mapLevel.PathPivot);
     }
 }
Exemplo n.º 3
0
    private WaypointsMover GenerateCharacter(Assets.Plugins.SmartLevelsMap.Scripts.Path path)
    {
        Transform character = PrefabUtility.InstantiatePrefab(_levelsMap.CharacterPrefab) as Transform;

        character.transform.parent = _levelsMap.transform;
        WaypointsMover waypointsMover = character.gameObject.AddComponent <WaypointsMover> ();

        waypointsMover.Path  = path;
        waypointsMover.Speed = Camera.main.orthographicSize;
        return(waypointsMover);
    }
Exemplo n.º 4
0
    private void DrawLevelsSettings()
    {
        GUILayout.BeginVertical("Box");
        EditorGUILayout.LabelField("General:");

        _levelsMap.WaypointsMover.Speed = EditorGUILayout.FloatField("Character speed", _levelsMap.WaypointsMover.Speed);

        _levelsMap.TranslationType = (TranslationType)EditorGUILayout.EnumPopup("Translation type", _levelsMap.TranslationType);

        if (_levelsMap.WaypointsMover.Path == null)
        {
            _levelsMap.WaypointsMover.Path = _levelsMap.transform.Find("Path").GetComponent <Assets.Plugins.SmartLevelsMap.Scripts.Path>();
        }

        Assets.Plugins.SmartLevelsMap.Scripts.Path path = _levelsMap.WaypointsMover.Path;
        path.IsCurved     = EditorGUILayout.Toggle("Curved", path.IsCurved);
        path.GizmosColor  = EditorGUILayout.ColorField("Gizmos Path Color", path.GizmosColor);
        path.GizmosRadius = EditorGUILayout.FloatField("Gizmos Path Pivot Radius", path.GizmosRadius);

        GUILayout.EndVertical();

        EditorUtility.SetDirty(path);
    }