Exemplo n.º 1
0
    public void ChangeScreen(Screen screen)
    {
        _currentScreen = screen;
        switch (screen)
        {
        case Screen.HotelView:
            _hotelView.SetActive(true);
            _espaceView.SetActive(false);
            _mapView.SetActive(false);
            _hotelModel.SetActive(true);
            _hotelSprite.ChangeSprite(0);
            _espaceSprite.ChangeSprite(1);
            _mapSprite.ChangeSprite(1);
            break;

        case Screen.EspaceView:
            _hotelView.SetActive(false);
            _espaceView.SetActive(true);
            _mapView.SetActive(false);
            _hotelModel.SetActive(false);
            _hotelSprite.ChangeSprite(1);
            _espaceSprite.ChangeSprite(0);
            _mapSprite.ChangeSprite(1);
            break;

        case Screen.MapView:
            _hotelView.SetActive(false);
            _espaceView.SetActive(false);
            _mapView.SetActive(true);
            _hotelModel.SetActive(false);
            _hotelSprite.ChangeSprite(1);
            _espaceSprite.ChangeSprite(1);
            _mapSprite.ChangeSprite(0);
            break;

        default:
            break;
        }
    }
Exemplo n.º 2
0
    public void DealHand()
    {
        Hold1.gameObject.SetActive(true);
        Hold2.gameObject.SetActive(true);
        Hold3.gameObject.SetActive(true);
        Hold4.gameObject.SetActive(true);
        Hold5.gameObject.SetActive(true);
        //Sets each card in player hand to new card in deck
        PHand.hand[0] = StartingDeck[count];
        SC.ChangeSprite(card1, 0);
        count++;
        CountCheck();

        PHand.hand[1] = StartingDeck[count];
        SC.ChangeSprite(card2, 1);
        count++;
        CountCheck();

        PHand.hand[2] = StartingDeck[count];
        SC.ChangeSprite(card3, 2);
        count++;
        CountCheck();

        PHand.hand[3] = StartingDeck[count];
        SC.ChangeSprite(card4, 3);
        count++;
        CountCheck();

        PHand.hand[4] = StartingDeck[count];
        SC.ChangeSprite(card5, 4);
        count++;
        CountCheck();

        //Deactivate this button and set the draw button
        DealButton.gameObject.SetActive(false);
        DrawButton.gameObject.SetActive(true);
    }
Exemplo n.º 3
0
    public virtual IEnumerator Move(Transform transform)
    {
        isMoving      = true;
        startPosition = transform.position;
        t             = 0;

        if (gridOrientation == Orientation.Horizontal)
        {
            endPosition = new Vector3(startPosition.x + System.Math.Sign(input.x) * gridSize,
                                      startPosition.y + System.Math.Sign(input.y) * gridSize, startPosition.z);
        }
        else
        {
            endPosition = new Vector3(startPosition.x + System.Math.Sign(input.x) * gridSize,
                                      startPosition.y + System.Math.Sign(input.y) * gridSize, startPosition.z);
        }


        RaycastHit2D hit = Physics2D.Linecast(startPosition, endPosition, finalMask); //Enemy Layer && wall layer

        if (hit.collider != null)
        {
            if (hit.collider.tag == "Enemy") //Should equal enemy or something
            {
                isMoving      = false;
                coroutineDone = true;
                StopAllCoroutines();
            }

            if (hit.collider.tag == "Wall")
            {
                isMoving      = false;
                coroutineDone = true;
                StopAllCoroutines();
            }
            yield return(null);
        }


        if (allowDiagonals && correctDiagonalSpeed && input.x != 0 && input.y != 0)
        {
            if (counter + 2 > moveRange)
            {
                isMoving      = false;
                coroutineDone = true;
                StopAllCoroutines();

                yield return(null);
            }
            factor = 0.7071f;
            yield return(null);
        }
        else
        {
            factor = 1f;
        }

        if (counter > moveRange)
        {
            isMoving = false;
            StopAllCoroutines();
        }

        counter++;


        while (t < 1f)
        {
            spriteChanger.ChangeSprite(input);
            t += Time.deltaTime * (moveSpeed / gridSize) * factor;
            transform.position = Vector3.Lerp(startPosition, endPosition, t);
            yield return(null);
        }


        isMoving      = false;
        coroutineDone = true;
        StopAllCoroutines();
        yield return(0);
    }
Exemplo n.º 4
0
 public void Initialize(int number)
 {
     numberChanger.ChangeSprite(number);
 }
Exemplo n.º 5
0
    public virtual IEnumerator Move(Transform transform)
    {
        isMoving      = true;
        startPosition = transform.position;
        Vector2 spriteMovement = new Vector2(input.x - startPosition.x, input.y - startPosition.y);

        t = 0;

        endPosition = input;


        RaycastHit2D hit = Physics2D.Linecast(startPosition, endPosition, finalMask);

        if (hit.collider != null)
        {
            Debug.Log(hit.collider.name);
            if (hit.collider.tag == "Player")
            {
                isMoving      = false;
                coroutineDone = true;
                GetComponent <EnemyActions>().AttackPlayer();
                StopAllCoroutines();
            }

            yield return(null);
        }

        if (Mathf.Abs(startPosition.x - endPosition.x) == 1 && Mathf.Abs(startPosition.y - endPosition.y) == 1)
        {
            if (counter + 2 >= moveRange)
            {
                isMoving      = false;
                coroutineDone = true;
                thisTurn.EndTurn();
                StopAllCoroutines();
            }
            counter++;

            factor = 0.7071f;
            yield return(null);
        }
        else
        {
            factor = 1f;
        }

        while (t < 1f)
        {
            spriteChanger.ChangeSprite(spriteMovement);
            t += Time.deltaTime * (moveSpeed / gridSize) * factor;
            transform.position = Vector3.Lerp(startPosition, endPosition, t);
            yield return(null);
        }

        counter++;

        if (counter >= moveRange)
        {
            isMoving      = false;
            coroutineDone = true;
            thisTurn.EndTurn();
            StopAllCoroutines();
        }

        isMoving      = false;
        coroutineDone = true;
        AttemptMove();
        yield return(0);
    }