Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        this.step_time_prev = this.step_time;
        this.step_time     += Time.deltaTime;

        switch (this.step_now)
        {
        case STEP.NONE:
            this.step_next = STEP.PLAY;
            break;

        case STEP.PLAY:
            if (this.piece_num_finished >= this.piece_num)
            {
                this.step_next = STEP.CLEAR;
            }
            break;
        }

        while (this.step_next != STEP.NONE)
        {
            this.step_now  = this.step_next;
            this.step_next = STEP.NONE;
            this.step_time = .0f;
            switch (this.step_now)
            {
            case STEP.PLAY:
                for (int i = 0; i < this.pieces_all.Length; i++)
                {
                    this.pieces_active[i] = this.pieces_all[i];
                }
                this.piece_num_finished = 0;
                this.shufflePieces();
                foreach (PieceControl _piece in this.pieces_all)
                {
                    _piece.restart();
                }
                this.setPiecesHeightOffset();
                break;

            case STEP.CLEAR:
                break;
            }
        }

        switch (this.step_now)
        {
        case STEP.CLEAR:
            const float clear_delay = 0.5f;
            if (this.step_time_prev < clear_delay && this.step_time >= clear_delay)
            {
                this.script_game_control.playSE(GameControl.SE.COMPLETE);
                this.is_clear_show = true;
            }
            break;
        }

        PuzzleControl.drawBounds(this.shuffle_zone);
    }
    // Use this for initialization
    void Start()
    {
        var go = Instantiate <GameObject>(puzzlePrefab);

        puzzleControl = go.GetComponent <PuzzleControl>();
        puzzleControl.gameSceneControl = this;
        nextState = State.Play;
    }
Exemple #3
0
 void Awake()
 {
     if (singleton == null)
     {
         singleton = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(singleton);
 }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        this.script_puzzle_control = (Instantiate(this.prefab_puzzle) as GameObject).GetComponent <PuzzleControl>();
//        this.sprite_finish = Sprite.Create(this.texture_finish, new Rect(0, 0, 256, 256), new Vector2(0.5f, 0.5f));
    }