Exemplo n.º 1
0
        public static void Init()
        {
            // Game Layer
            mapRoot = new LevelParent();
            cache   = new Dictionary <string, Level>();
            initial = true;
            //currentLevelPath = null;
            currentLevel  = null;
            previousLevel = currentLevel;

            // UI Layer
            pausedText       = new TextShadowEntity(new Vector2(340, 540), "Paused", Color.White);
            pausedText.State = EntityStates.Disabled;

            deadText       = new TextShadowEntity(new Vector2(340, 540), "Defeat", Color.White);
            deadText.State = EntityStates.Disabled;

            winText       = new TextShadowEntity(new Vector2(340, 540), "Victory", Color.White);
            winText.State = EntityStates.Disabled;

            retryDialog = new RetryDialog();
            //retryDialog.State = EntityStates.Disabled;

            // UI Backdrop
            backdrop = new Backdrop();
            Scene.Add(backdrop);
            var backdropTransform = backdrop.GetComponent <Transform>();

            backdropTransform.AddChild(mapRoot);

            // Debug
            showFPS = false;
        }
Exemplo n.º 2
0
    private static void RemoveBlock(Vector3 position)
    {
        for (int i = 0; i < LevelParent.childCount; i++)
        {
            float distanceToBlock = Vector3.Distance(LevelParent.GetChild(i).transform.position, position);
            if (distanceToBlock <= 4)
            {
                Undo.DestroyObjectImmediate(LevelParent.GetChild(i).gameObject);

                UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty();
                return;
            }
        }
    }
Exemplo n.º 3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     levelParent = GameObject.FindWithTag("Level").GetComponent <LevelParent>();
     PrepareData("testdrums");
     numLoops = 0f;
 }
Exemplo n.º 4
0
    void Start()
    {
        if (_control == null)
        {
            DontDestroyOnLoad(gameObject);
            _control = this;
        }
        else if (_control != this)
        {
            Destroy(gameObject);
        }

        Scene currentScene = SceneManager.GetActiveScene();

        if (currentScene.name == "LevelBuilder")
        {
            DontDestroyOnLoad(gameObject);
        }
    }
Exemplo n.º 5
0
    public static void RemoveObject(Vector3 pos)
    {
        if (LevelParent.childCount <= 0)
        {
            return;
        }

        for (int i = 0; i < LevelParent.childCount; i++)
        {
            Renderer renderer = LevelParent.GetChild(i).GetComponent <Renderer>();

            float distanceToObject = Vector3.Distance(renderer.bounds.min, pos);
            if (distanceToObject < 1.0f)
            {
                Undo.DestroyObjectImmediate(LevelParent.GetChild(i).gameObject);
                UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty();
                return;
            }
        }
    }
Exemplo n.º 6
0
    void Awake()
    {
        numLoops = 0f;

        meshChildOrigYScale = meshChild.localScale.y;

        rotateDummy = transform.parent;


        //Subscribe to onEndReached event
        //TODO - unsubscribe when switching paths
        mySplineFollower = transform.root.GetComponent <SplineFollower>();



        dummyCurrentRotation = 0f;
        rotationAngle        = 360f / SongManager.instance.CurrentSong.tracks.Length;

        level       = GameObject.FindWithTag("Level");
        levelParent = level.GetComponent <LevelParent>();
        songManager = SongManager.instance;

        mySource = GetComponent <AudioSource>();
    }