예제 #1
0
    // 동물 세팅 함수.
    // 실제 위치가 아닌 몇번째 칸에 있는지 세팅함.
    public void SetData(int x_idx, int y_idx)
    {
        if (animal_type == eAnimalType.None)
        {
            int animal_num = Random.Range(1, 7);
            sprite.spriteName = string.Format(ANIMAL_NAME, animal_num);
            animal_type       = (eAnimalType)animal_num;
        }

        position_idx = new AnimalPositionIndex(x_idx, y_idx);
        //test_label.text = string.Format("{0}, {1}", x_idx, y_idx);
    }
예제 #2
0
 public override void ResetItem()
 {
     destroy_ani.ResetToBeginning();
     SetSelect(false);
     animal_type = eAnimalType.None;
 }
예제 #3
0
    void FriendMove(int pData, eAnimalType pCurrAnimalType)
    {
        pData = pData - 1;
        if (pCurrAnimalType == eAnimalType.goat)
        {
            markerToMove.GetComponent <Image> ().sprite = goatTexture;
            if (noOfGoat >= gameManager.totalNoOfGoat)
            {
                if (allTgNodes [pData].currNodeHolder == eNodeHolder.goat)
                {
                    selectedGoatIndex     = pData;
                    markerToMove.position = allTgNodes [pData].transform.position;
                    MarkerReset();
                    allTgNodes [selectedGoatIndex].transform.GetChild(0).gameObject.SetActive(true);
                }
                else if (selectedGoatIndex >= 0 && allTgNodes [pData].currNodeHolder == eNodeHolder.none)
                {
                    if (SetDataGoat(pData))
                    {
                        MarkerReset();
                        endPos     = allTgNodes [pData].transform;
                        isMoveAlow = true;
//						speed = Vector3.Distance (markerToMove.position,endPos.position) / 5f;
                        markerToMove.gameObject.SetActive(true);
                        if (gameManager.currTurnStatus == eTurnStatus.friend)
                        {
                            gameManager.currTurnStatus = eTurnStatus.my;
                            TurnMsg(true);
//							turnMsg.text = "You";
                        }
                        else
                        {
                            gameManager.currTurnStatus = eTurnStatus.friend;
                            TurnMsg(false);
                            turnMsg.text = "Friend";
                        }

                        if (IsAiEnable(true))
                        {
                            StartCoroutine("AITurnTiger");
                        }
                    }
                }
            }
            else
            {
                if (allTgNodes [pData].currNodeHolder != eNodeHolder.none)
                {
                    return;
                }
                noOfGoat++;
                usedGoatTxt.text      = (gameManager.totalNoOfGoat - noOfGoat).ToString();
                markerToMove.position = defaultPos.position;
                markerToMove.gameObject.SetActive(true);
                endPos = allTgNodes [pData].transform;
                allTgNodes [pData].currNodeHolder = eNodeHolder.goat;
                isMoveAlow = true;
//                allTgNodes[pData].SetNodeHolderSprint();
                if (gameManager.currTurnStatus == eTurnStatus.friend)
                {
//					turnMsg.text = "You";
                    gameManager.currTurnStatus = eTurnStatus.my;
                    TurnMsg(true);
                }
                else
                {
//					turnMsg.text = "Friend";
                    gameManager.currTurnStatus = eTurnStatus.friend;
                    TurnMsg(false);
                }
                if (IsAiEnable(true))
                {
                    StartCoroutine("AITurnTiger");
                }
            }
            Debug.Log("Check gamme over for tiger-------------------------->>>>");
            if (!IsTigerMoveAlv())
            {
                Debug.Log(" gamme over -----------------------tiger nomove--->>>>");
                currWinStatus = eWinStatus.goat;
                UIManager.instance.OnGameOver();
            }
        }
        else if (pCurrAnimalType == eAnimalType.tiger)
        {
            markerToMove.GetComponent <Image> ().sprite = tigerTexture;
            if (!IsTigerMoveAlv())
            {
                currWinStatus = eWinStatus.goat;
                UIManager.instance.OnGameOver();
            }
            if (allTgNodes [pData].currNodeHolder == eNodeHolder.tiger)
            {
                selectedGoatIndex     = pData;
                markerToMove.position = allTgNodes [pData].transform.position;
                MarkerReset();
                allTgNodes [selectedGoatIndex].transform.GetChild(0).gameObject.SetActive(true);
            }
            else if (selectedGoatIndex >= 0 && allTgNodes [pData].currNodeHolder == eNodeHolder.none)
            {
                if (SetDataTiger(pData))
                {
                    MarkerReset();
                    endPos     = allTgNodes [pData].transform;
                    isMoveAlow = true;
                    markerToMove.gameObject.SetActive(true);
//					speed = Vector3.Distance (markerToMove.position,endPos.position) / 5f;
                    if (gameManager.currTurnStatus == eTurnStatus.friend)
                    {
//						turnMsg.text = "You";
                        gameManager.currTurnStatus = eTurnStatus.my;
                        TurnMsg(true);
                    }
                    else
                    {
                        gameManager.currTurnStatus = eTurnStatus.friend;
                        TurnMsg(false);
//						turnMsg.text = "Friend";
                    }
                    if (IsAiEnable(false))
                    {
                        StartCoroutine("AITurnGoat");
                    }
                }
            }
        }
    }