Exemple #1
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate)
        {
            this.panelPosition = panelPosition;
            this.playerType    = playerType;
            this.tDelegate     = tDelegate;

            Initialize();
            Random rnd1 = new Random(Guid.NewGuid().GetHashCode());
            Random rnd2 = new Random(Guid.NewGuid().GetHashCode());

            if (playerType == PlayerType.Human)
            {
                while (brain.stIndex < brain.st.Length - 1)
                {
                    int    row    = rnd1.Next(0, 10);
                    int    column = rnd1.Next(0, 10);
                    string msg    = string.Format("{0}_{1}", row, column);
                    brain.Process(msg);
                }
            }

            if (playerType == PlayerType.Bot)
            {
                while (brain.stIndex < brain.st.Length - 1)
                {
                    int    row    = rnd2.Next(0, 10);
                    int    column = rnd2.Next(0, 10);
                    string msg    = string.Format("{0}_{1}", row, column);
                    brain.Process(msg);
                }
            }
        }
        public PlayerPanel(Point Location, PlayerType playerType, TurnDelegate tDelegate)
        {
            this.Location  = Location;
            this.pType     = playerType;
            this.tDelegate = tDelegate;

            Initialize();
        }
Exemple #3
0
 public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, TurnDelegate gDelegate, Color ColorBot)
 {
     this.panelPosition = panelPosition;
     this.playerType    = playerType;
     this.tDelegate     = tDelegate;
     this.gDelegate     = gDelegate;
     this.ColorBot      = ColorBot;
     Initialize();
 }
Exemple #4
0
 // Start is called before the first frame update
 void Start()
 {
     #region PLATFORM FOR TURNING
         #if UNITY_EDITOR
     turndelegate = TurnPlayerUsingKeyboard;
         #endif
         #if UNITY_ANDROID
     turndelegate = TurnPlayerUsingTouch;
         #endif
     #endregion
     gameManager = GameObject.FindObjectOfType <GameManager>();
     anim        = gameObject.GetComponent <Animator>();
     LoadHighScore();
 }
Exemple #5
0
    // Start is called before the first frame update
    void Start()
    {
        #region PLATFORM FOR TURNING
            #if UNITY_EDITOR
        turnDelegate = TurnPlayerUsingKeyboard;
            #endif
            #if UNITY_ANDROID
        turnDelegate = TurnPlayerUsingTouch;
            #endif
        #endregion

        gameManager = GameObject.FindObjectOfType <GameManager>(); //tipi game manger olan nesneyi al
        anim        = gameObject.GetComponent <Animator>();        //animasyona başlaması için tip aldık

        LoadHighScore();                                           // high scoru yaz
    }
 // Update is called once per frame
 void Update()
 {
     if (gameManager.gameStarted)
     {
         animController.SetTrigger("gameStarted");
         Move();
         #if UNITY_EDITOR
         turn = TurnWithKeyboard;
         #endif
         #if UNITY_ANDROID
         turn = TurnWithFinger;
         #endif
         //TurnWithKeyboard();
         turn();
         CheckFalling();
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        #region PLATFORM FOR TURNING
            #if UNITY_EDITOR
        turnDelegate = TurnPlayerUsingKeyboard;
            #endif
            #if UNITY_ANDROID
        turnDelegate = TurnPlayerUsingTouch;
            #endif
        #endregion


        gameManager = GameObject.FindObjectOfType <GameManager>();     // sürükle bırak yapmamak için zaten GameManager tipinde tek obje var.
        anim        = gameObject.GetComponent <Animator>();

        LoadHighScore();
    }
Exemple #8
0
    // Start is called before the first frame update
    void Start()
    {
        LoadHScore();
        HScoreText.text = hscore.ToString();

#if UNITY_EDITOR_OSX
        turnDelegate = TurnWithKeyboard;
#endif
#if UNITY_EDITOR_WIN
        turnDelegate = TurnWithKeyboard;
#endif
#if UNITY_ANDROID
        turnDelegate = TurnWithTouch;
#endif
#if UNITY_IOS
        turnDelegate = TurnWithTouch;
#endif
    }
Exemple #9
0
    // Start is called before the first frame update
    void Start()
    {
        #region ChoosingPlatformforTurning
#if UNITY_EDITOR
        turnDelegate = TurnPlayerUsingKeyboard;
#endif

#if UNITY_ANDROID
        turnDelegate = TurnPlayerUsingTouchControl;
#endif
        #endregion


        gameManager = GameObject.FindObjectOfType <gameManager>();
        anim        = gameObject.GetComponent <Animator>();

        LoadHighScore();
    }
Exemple #10
0
    public ParticleSystem effect;             //elmasları aldığında çıkan duman efekti;

    void Start()                              // Start is called before the first frame update
    {
        //platform;
        #region PLATFORM FOR TURNİNG
            #if UNITY_EDITOR
        turnDelegate = TurnUsingKeyboard;
            #endif
            #if UNITY_ANDROID
        turnDelegate = TurnUsingTouch;
            #endif
            #if UNITY_IOS
        turnDelegate = TurnUsingTouch;
            #endif
        #endregion

        //oyunun başlamasını kontrol etmek için oyun dosyalarında
        //GameManager tipli objenin buunmasını sağladık;
        gameManager = GameObject.FindObjectOfType <GameManager>();
        anim        = gameObject.GetComponent <Animator>();
        LoadHighScore();
    }
Exemple #11
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, Color BusyColor)
        {
            this.playerType    = playerType;
            this.panelPosition = panelPosition;
            this.tDelegate     = tDelegate;
            this.BusyColor     = BusyColor;
            Initialize();

            switch (panelPosition)
            {
            case PanelPosition.Left:
                //RndH();
                break;

            case PanelPosition.Right:
                RndB();
                break;

            default:
                break;
            }
        }
Exemple #12
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, Color ColorToFillBusy)
        {
            this.panelPosition   = panelPosition;
            this.playerType      = playerType;
            this.tDelegate       = tDelegate;
            this.ColorToFillBusy = ColorToFillBusy;

            Initialize();

            //Random rnd1 = new Random(Guid.NewGuid().GetHashCode());
            //Random rnd2 = new Random(Guid.NewGuid().GetHashCode());

            if (playerType == PlayerType.Human)
            {
                //RandomGenerateShips();
            }

            if (playerType == PlayerType.Bot)
            {
                //RandomGenerateShips();
                this.Enabled = false;
            }
        }
 public GameLogic(TurnDelegate GameDlg)
 {
     p1 = new PlayerPanel(PanelPosition.Left, PlayerType.Human, MakeBotTurn, GameDlg, Color1);
     p2 = new PlayerPanel(PanelPosition.Right, PlayerType.Bot, MakeBotTurn, GameDlg, Color2);
 }