Ejemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Game Player
            IGameView      gameView       = new GameFormView();
            Game           gameModel      = new Game();
            GameController gameController = new GameController(gameModel, gameView);
            GameBoardForm  gameBoard      = new GameBoardForm(gameView, gameController);

            // File Handler
            IFiler  filer  = new Filer();
            ISaver  saver  = (ISaver)filer;
            ILoader loader = (ILoader)filer;

            FilerForm       filerView    = new FilerForm();
            IGameFiler      gameFiler    = new GameFiler();
            FilerController filerControl = new FilerController(saver, loader, filer, gameFiler, gameModel, filerView);

            // Level Designer
            ILevelDesignView designView  = new LevelDesignerForm();
            IChecker         designCheck = new Checker();
            ILevelDesigner   designModel = new LevelDesigner(designCheck);

            ILevelDesignController designController = new LevelDesignController(designView, designModel);


            BaseForm baseForm = new BaseForm(gameBoard, filerControl, designController);

            Application.Run(baseForm);
        }
Ejemplo n.º 2
0
    static void OpenWindow()
    {
        LevelDesigner window = (LevelDesigner)GetWindow(typeof(LevelDesigner));

        window.minSize = new Vector2(300, 300);
        window.Show();
    }
Ejemplo n.º 3
0
    void Start()
    {
        scoreDisplay                = FindObjectOfType <ScoreDisplay>();
        multiplierDisplay           = FindObjectOfType <MultiplierDisplay>();
        background                  = GameObject.FindObjectOfType <Background>();
        playerAnim                  = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();
        divisionStepChangeCountdown = divisionStepInterval;
        gameSpeed                = initialGameSpeed;
        spawnRate                = initialSpawnRate;
        rotationSpeed            = initialRotationSpeed;
        levelDesigner            = GetComponent <LevelDesigner>();
        gameManager              = FindObjectOfType <GameManager>();
        audioManager             = FindObjectOfType <AudioManager>();
        currentSelectables       = new GameObject[numberOfSelectableMods];
        currentSelectablesScript = new Module[numberOfSelectableMods];
        spawnedMods              = new GameObject[maxNumOfModsInGame]; // these does not include spawned modules that have reached the player
        spawnedModsIndex         = -1;
        selectedModIndex         = 0;
        queueLength              = levelDesigner.queueLength;
        spawnQueue               = new Vector2[queueLength];
        for (int i = 0; i < spawnQueue.Length; i++)
        {
            spawnQueue[i] = new Vector2(-1, -1);
        }
        SetProbabilities();

        //initial boost
        SetSpeed(initialGameSpeed * 10, 400, initialSpawnRate * 10, initialRotationSpeed);

        setMultiplier();
        //for at forhindre at man får en konflikt med flere setspeed kald hvis man får starpower imens spillet er ved at starte
        StartCoroutine(DisableControls());
    }
Ejemplo n.º 4
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        LevelDesigner window = (LevelDesigner)EditorWindow.GetWindow(typeof(LevelDesigner));

        window.Show();
    }
 private void MakeInstance()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Ejemplo n.º 6
0
 void LoadLevel(int lvl)
 {
     levelDidReset = true;
     GameClock.Instance.ResetClock();
     DestroyNonPlayer();
     levelData = LevelDesigner.Generate(0);
     PopulateAgents();
     OnLevelEvent?.Invoke(LevelEventType.LOADED);
 }
Ejemplo n.º 7
0
    void Update()
    {
        levelDesigner = FindObjectOfType <LevelDesigner>();

        if (levelDesigner != null)
        {
            SelectTheme(themeSelection);
        }
    }
Ejemplo n.º 8
0
    void OnEnable()
    {
        script = (LevelDesigner)target;

        if (!Application.isPlaying)
        {
            Tools.current = Tool.View;
        }
    }
Ejemplo n.º 9
0
    void Update()
    {
        levelDesigner = FindObjectOfType <LevelDesigner>();
        var main = ps.main;

        if (levelDesigner != null)
        {
            main.startColor = SelectTheme(themeSelection);
        }
    }
Ejemplo n.º 10
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 11
0
 private void Update()
 {
     if (!PhotonNetwork.isMasterClient && !getLevelDesigner && levelDesigner == null)
     {
         GameObject instanceLevelDedigner = GameObject.Find(levelDesignerPrefab.name + "(Clone)");
         if (instanceLevelDedigner)
         {
             levelDesigner    = instanceLevelDedigner.GetComponent <LevelDesigner>();
             getLevelDesigner = true;
         }
     }
 }
Ejemplo n.º 12
0
 public static float GetPlayerNormalSpeed(float playerInitSpeed)
 {
     if (GameConst.instance.gameMode == 0)
     {
         float coefficient = (GameConst.Level != 1) ? (float)(GameConst.Level - 1) / 17 : 0;
         return(playerInitSpeed + (int)(35 * (1 - Mathf.Exp(-(coefficient)))));
     }
     else if (GameConst.instance.gameMode == 1)
     {
         return(playerInitSpeed + ((GameConst.Level - 1) * LevelDesigner.speedUp(0)));
     }
     else
     {
         return(playerInitSpeed);
     }
 }
Ejemplo n.º 13
0
    void OnEnable()
    {
        script = (LevelDesigner) target;

        if(!Application.isPlaying)
        {
            if (SceneView.lastActiveSceneView != null)
            {
                Tools.current = Tool.View;
                SceneView.lastActiveSceneView.orthographic = true;
                SceneView.lastActiveSceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot,Quaternion.identity);
                leftControl = false;
                batchmode = BatchMode.None;
            }
        }
    }
Ejemplo n.º 14
0
    //public Transform transform;
    public override void OnInspectorGUI()
    {
        LevelDesigner Level = (LevelDesigner)target;

        base.OnInspectorGUI();
        if (GUILayout.Button("[1] Spawn"))
        {
            Level.SpawmOne();
        }
        if (GUILayout.Button("[2] Spawn"))
        {
            Level.SpawmTwo();
        }
        if (GUILayout.Button("[3] Spawn"))
        {
            Level.SpawmThree();
        }
    }
Ejemplo n.º 15
0
    public void LevelChanger(float playerMAX)
    {
        gunScript.StopGun();
        Level = LevelDesigner.levelUp(Level);

        Player.instance.speed.z     = LevelDesigner.speedUp(Player.instance.speed.z);
        Player.instance.normalSpeed = Player.instance.speed.z;

        if (gameMode == 0)
        {
            Debug.Log("Level Finish Has Started");
            StartCoroutine(LevelEndedState(playerMAX));
        }
        else if (gameMode == 1)
        {
            Debug.Log("Endless Finish Has Started");
            StartCoroutine(LevelChangeState(playerMAX, Player.instance.speed.z));
        }
    }
Ejemplo n.º 16
0
    private const int gameEndFontSize = 200;                                //ゲーム終了時に変更するフォントサイズの値

    private void Start()
    {
        //UIを非アクティブに
        sightingImage.enabled    = false;
        mainText.enabled         = false;
        shootButtone.enabled     = false;
        GameEndBackImage.enabled = false;

        //マスタークライアントのみ、GameManagerを生成する
        if (PhotonNetwork.isMasterClient)
        {
            //「LevelDesigner」を生成
            GameObject instanceLevelDedigner = PhotonNetwork.Instantiate(levelDesignerPrefab.name, Vector3.zero, Quaternion.identity, 0);
            levelDesigner    = instanceLevelDedigner.GetComponent <LevelDesigner>();
            getLevelDesigner = true;
        }

        //レベルデザインをロードするまで待機する関数
        StartCoroutine(GameStartWait());
    }
Ejemplo n.º 17
0
    private void GetDesigner()
    {
        if (TryGetComponent(out levelDesigner))
        {
            levelDesigner.OnTimerTick -= UIController.GetMenu <GameMenu>().ShowTimer;
            Destroy(levelDesigner);
        }
        switch (gameType)
        {
        case GameType.Logic: levelDesigner = gameObject.AddComponent <LogicLevelDesigner>(); break;

        case GameType.Mathematic: levelDesigner = gameObject.AddComponent <MathematicLevelDesigner>(); break;

        case GameType.Memory: levelDesigner = gameObject.AddComponent <MemoryLevelDesigner>(); break;

        case GameType.Attention: levelDesigner = gameObject.AddComponent <AttentionLevelDesigner>(); break;

        default: Debug.LogError("Не найден дезайнер уровней"); break;
        }
        levelDesigner.OnTimerTick += UIController.GetMenu <GameMenu>().ShowTimer;
    }
Ejemplo n.º 18
0
 //awake
 void Awake()
 {
     levelDesigner = GameObject.Find("GameBoard").GetComponent <LevelDesigner> ();
 }
Ejemplo n.º 19
0
 private void Awake()
 {
     LevelDesigner.Instance = this;
 }
Ejemplo n.º 20
0
        protected void createGameBoard(int rows, int columns, bool isloaded)
        {
            if (isloaded != true)
            {
                //creating Level
                LevelDesigner.createLevel(rows, columns);
                LevelDesigner.MyLevel.CreateCells();
            }

            //Clear out the existing controls, we are generating a new table layout
            GameBoard.Controls.Clear();
            GameBoard.ColumnStyles.Clear();
            GameBoard.RowStyles.Clear();

            //Now we will generate the table, setting up the row and column counts first
            GameBoard.ColumnCount = columns;
            GameBoard.RowCount    = rows;

            //creating rows
            for (int y = 0; y < LevelDesigner.MyLevel.Height; y++)
            {
                //create a row
                GameBoard.ColumnStyles.Add(new ColumnStyle(SizeType.Percent));

                //creating columns
                for (int x = 0; x < LevelDesigner.MyLevel.Width; x++)
                {
                    //create the grid
                    CustomControl_Button btn_Cell = new CustomControl_Button()
                    {
                        Name = count.ToString()
                    };

                    //adding the cells from cell collection to the btn
                    btn_Cell.ChildCell = LevelDesigner.MyLevel.CellCollection[count];

                    //setting the button size
                    btn_Cell.Size    = new Size(40, 40);
                    btn_Cell.Padding = new Padding(0);
                    btn_Cell.Margin  = new Padding(0);
                    btn_Cell.Click  += Button_OnClick_For_Cell;

                    MenuItem m1 = new MenuItem("LeftTile", new EventHandler(ContextMenu_OnClick_For_TileLeft));
                    MenuItem m2 = new MenuItem("UpTile", new EventHandler(ContextMenu_OnClick_For_TileUp));
                    MenuItem m3 = new MenuItem("BlankTile", new EventHandler(ContextMenu_OnClick_For_TileBlank));
                    MenuItem m4 = new MenuItem("LeftUpTile", new EventHandler(ContextMenu_OnClick_For_TileLeftUp));
                    MenuItem m5 = new MenuItem("Exit", new EventHandler(ContextMenu_OnClick_For_TileExit));
                    MenuItem m6 = new MenuItem("Theseus", new EventHandler(ContextMenu_OnClick_For_Theseus));
                    MenuItem m7 = new MenuItem("Minotaur", new EventHandler(ContextMenu_OnClick_For_Minotaur));

                    btn_Cell.ContextMenu = new System.Windows.Forms.ContextMenu();
                    btn_Cell.ContextMenu.MenuItems.Add(m1);
                    btn_Cell.ContextMenu.MenuItems.Add(m2);
                    btn_Cell.ContextMenu.MenuItems.Add(m3);
                    btn_Cell.ContextMenu.MenuItems.Add(m4);
                    btn_Cell.ContextMenu.MenuItems.Add(m5);
                    btn_Cell.ContextMenu.MenuItems.Add(m6);
                    btn_Cell.ContextMenu.MenuItems.Add(m7);

                    //Finally, add the control to the correct location in the table
                    GameBoard.Controls.Add(btn_Cell, x, y);
                    count += 1;
                }
            }
            if (isloaded != true)
            {
                //AddBorders();
                theseus  = new Theseus();
                minotaur = new Minotaur();
            }
        }
Ejemplo n.º 21
0
 public void SetLevelDesigner(LevelDesigner _levelDesigner)
 {
     m_levelDesigner = _levelDesigner;
 }
 void OnEnable()
 {
     script = (LevelDesigner)target;
 }
Ejemplo n.º 23
0
    void Update()
    {
        bar.set(5000f, pelanggan.kesabaran);
        //cek state
        switch (pelanggan.state)
        {
        case 0:
            //randomize pelanggan tersedia + pesanannya
            pelanggan = new Pelanggan("garong", "ikan goreng");
            break;

        case 1:
            render.color = new Color32(225, 80, 80, 0);
            //jalan ke antre.kalau belum sampai, jalan. kalau sudah ganti state 2
            if (transform.position.y > kursi.y)
            {
                rb.MovePosition(transform.position + new Vector3(0, -1) * speed * Time.deltaTime);
                skin.Play("Base Layer.walk_down");
            }
            else
            {
                pelanggan.state++;
                GameObject.FindWithTag("manajer").GetComponent <Ordermanager>().isAntrianGerak = false;
                skin.Play("Base Layer.down");
            }
            break;

        case 2:
            render.color = new Color32(225, 80, 80, 255);
            //kalau belum dapat kursi kurangi kesabaran, pergantian state ke state 3 ditangani player
            if (pelanggan.kesabaran > 0)
            {
                if (!UI_Controller.isPaused)
                {
                    pelanggan.kesabaran--;
                }
            }
            else
            {
                pelanggan.state = 5;
                LevelDesigner.kurangreputasi(1);
                GameObject.FindWithTag("manajer").GetComponent <Ordermanager>().keluarAntrian(noAntri);
            }

            break;

        case 3:
            render.color = new Color32(225, 80, 80, 0);
            skin.Play("Base Layer.right");
            //kalau belum dapat makanan kurangi kesabaran, pergantian state ke state 4 ditangani player
            if (pelanggan.kesabaran > 0)
            {
                if (!UI_Controller.isPaused)
                {
                    pelanggan.kesabaran--;
                }
            }
            else
            {
                pelanggan.state = 5;
                LevelDesigner.kurangreputasi(1);
                GameObject.FindWithTag("manajer").GetComponent <Ordermanager>().pulang(noKursi);
            }

            break;

        case 4:
            //tunggu 10 detik lalu ganti ke state 5 dan bayar makan
            if (waktumakan > 0)
            {
                if (!UI_Controller.isPaused)
                {
                    waktumakan--;
                }
            }
            else
            {
                if (warnamakanan.ToLower() == pelanggan.warna.ToLower())
                {
                    LevelDesigner.bayar(10);
                    LevelDesigner.tambahreputasi(2);
                }
                else
                {
                    LevelDesigner.bayar(5);
                    LevelDesigner.tambahreputasi(1);
                }
                pelanggan.state++;
                GameObject.FindWithTag("manajer").GetComponent <Ordermanager>().pulang(noKursi);
            }
            break;

        case 5:
            //kalau belum sampai, jalan. kalau sudah trigger pelanggan baru di order manager dan hancurkan objek
            if (transform.position.x > keluar.x)
            {
                skin.Play("Base Layer.left");
                rb.MovePosition(transform.position - new Vector3(1, 0) * speed * Time.deltaTime);
            }
            else if (transform.position.y < keluar.y)
            {
                skin.Play("Base Layer.walk_up");
                rb.MovePosition(transform.position + new Vector3(0, 1) * speed * Time.deltaTime);
            }
            else
            {
                Destroy(gameObject);
            }
            break;
        }
    }
Ejemplo n.º 24
0
    void datangbaru()
    {
        var temp = Instantiate(pelanggan, masuk.position, Quaternion.identity);

        temp.GetComponent <Kodepelanggan>().kursi     = antre[2].position;
        temp.GetComponent <Kodepelanggan>().noAntri   = 2;
        temp.GetComponent <Kodepelanggan>().pelanggan = new Pelanggan("a", level.pesanRandom(), LevelDesigner.intToStringWarna(level.datang()));
        temp.GetComponent <Kodepelanggan>().pilihSkin();
        antrian[2]       = temp;
        antrianterisi[2] = true;
    }
Ejemplo n.º 25
0
 /// <summary>
 /// Start this instance.
 /// </summary>
 void Start()
 {
     levelDesignerObject = GameObject.Find("GameBoard");
     levelDesigner       = levelDesignerObject.GetComponent <LevelDesigner> ();
 }