Exemple #1
0
        // Disable maximize& minimize & close button
        private void sourceInitialized(object sender, EventArgs e)
        {
            IntPtr _windowHandle = new WindowInteropHelper(this).Handle;

            WinHandler.DisableMinimizeAndMaximizeButton(_windowHandle);
            WinHandler.DisableCloseButton(_windowHandle);
        }
Exemple #2
0
 public void GameOver(int winner)
 {
     if (state == GameState.End)
     {
         state = GameState.Start;
         if (winner == 0)
         {
             map.ResetPieces();
             foreach (var piece in _piecesList)
             {
                 piece.Reset();
                 map.PutPiece(Vector3Int.RoundToInt(piece.CurrentPosition - piece.offset), piece);
             }
             WinHandler?.Invoke();
         }
         else
         {
             if (LossHandler != null)
             {
                 LossHandler(GetTeamAlive(1));
             }
             map.ResetPieces();
         }
         SetDraggable(true, 0);
         currentPiece = _piecesList.GetEnumerator();
         foreach (var piece in _piecesList)
         {
             piece.Reset();
             map.PutPiece(Vector3Int.RoundToInt(piece.CurrentPosition - piece.offset), piece);
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (health <= 0 && alive)
        {
            GameObject eSys  = GameObject.Find("EventSystem");
            WinHandler wHand = (WinHandler)eSys.GetComponent(typeof(WinHandler));
            wHand.enemyKilled();
            alive = false;
            floorHandler.removeEnemy(gameObject);

            GameObject     tempRD   = Instantiate(ragdoll, transform.position, transform.rotation);
            RagdollHandler rHandler = (RagdollHandler)tempRD.GetComponent(typeof(RagdollHandler));
            rHandler.pushRagdoll(pushValue);
            Destroy(gameObject);
        }
        else if (health > 0)
        {
            if (GameObject.Find("Player_fab") != null)
            {
                sightHandler.transform.LookAt(player.transform);
            }

            Vector3    rayOrigin = sightHandler.transform.position;
            RaycastHit hit;
            if (Physics.Raycast(rayOrigin, sightHandler.transform.forward, out hit, 1000) && hit.transform.gameObject.name == "Player_fab")
            {
                //gameObject.transform.LookAt(player.transform);
                var q = Quaternion.LookRotation(player.transform.position - transform.position);
                transform.rotation = Quaternion.RotateTowards(transform.rotation, q, 750 * Time.deltaTime);
                shooting           = true;
                StartCoroutine("WaitBeforeShooting");
            }
            else if (moveCycleStart)
            {
                shooting = false;
                waited   = false;
                StartCoroutine("MoveCycle1");
                RB.velocity = transform.forward * moveVelocity;
            }
            else
            {
                shooting    = false;
                waited      = false;
                RB.velocity = transform.forward * moveVelocity;
            }
        }
    }
Exemple #4
0
        private void Window_StateChanged(object sender, EventArgs e)
        {
            switch (this.WindowState)
            {
            case WindowState.Maximized:
                break;

            case WindowState.Minimized:
                Router.instance.HideMain();
                Router.instance.DisplayPage(Router.Pages.Main);
                WinHandler?.Invoke(this, new WinState(WinState.State.Hide));
                break;

            case WindowState.Normal:
                WinHandler?.Invoke(this, new WinState(WinState.State.Show));
                break;
            }
        }
Exemple #5
0
    private void Update() //Update UIs
    {
        scoreText.text = match.score.ToString() + "/" + match.targetScore.ToString();
        int movesLeft = (match.totalMoves - match.moves);

        movesText.text = movesLeft.ToString();
        if (movesLeft <= 0)
        {
            match.LockBoard(true);
        }
        if (match.score >= match.targetScore)
        {
            if (!isWon) //only call once
            {
                WinHandler.CallWin(match.difficulty);
                isWon = true;
            }
        }
    }
Exemple #6
0
 private void Start()
 {
     Instance = this;
 }