Пример #1
0
    private void changeBoatPeople(State.Boat boatState, int boatMissionaryNumber, int boatCannibalNumber)
    {
        int peopleOnBoatSpawnPoint;
        int boatSpawnPoint;

        if (boatState == Boat.LEFT_R || boatState == Boat.FROM_LEFT_TO_RIGHT_R)
        {
            peopleOnBoatSpawnPoint = 3;
            boatSpawnPoint         = 7;
        }
        else
        {
            peopleOnBoatSpawnPoint = 4;
            boatSpawnPoint         = 8;
        }

        changeBoat(boatState, boatSpawnPoint);

        // 없애고 다시만듬ㅎ
        for (var i = 0; i < boatPeopleObjectList.Count; i++)
        {
            Destroy(boatPeopleObjectList[i].gameObject);
        }
        boatPeopleObjectList.Clear();

        changeCurrentState(boatMissionaryNumber,
                           peopleOnBoatSpawnPoint, boatPeopleObjectList, missionary);

        changeCurrentState(boatMissionaryNumber + boatCannibalNumber,
                           peopleOnBoatSpawnPoint, boatPeopleObjectList, cannibal);

        // 이동
        float increaseX = 0f;

        if (boatState == Boat.FROM_LEFT_TO_RIGHT_R)
        {
            foreach (var boatObject in boatPeopleObjectList)
            {
                Vector3 position = spawnPoints[4].position;
                position.x         += increaseX;
                boatObject.position = position;
                increaseX          += 1.0f;
            }
            // 위치 변경
            boat.position = spawnPoints[boatSpawnPoint + 1].position;
        }
        else if (boatState == Boat.FROM_RIGHT_TO_LEFT_L)
        {
            foreach (var boatObject in boatPeopleObjectList)
            {
                Vector3 position = spawnPoints[3].position;
                position.x         += increaseX;
                boatObject.position = position;
                increaseX          += 1.0f;
            }
            // 위치 변경
            boat.position = spawnPoints[boatSpawnPoint - 1].position;
        }
    }
Пример #2
0
 public GameState(int leftMissionaryNumber, int leftCannibalNumber, int rightMissionaryNumber, int rightCannibalNumber, State.Boat boatState)
 {
     peopleState = State.People.READY;
     this.leftMissionaryNumber  = leftMissionaryNumber;
     this.leftCannibalNumber    = leftCannibalNumber;
     this.rightMissionaryNumber = rightMissionaryNumber;
     this.rightCannibalNumber   = rightCannibalNumber;
     this.boatState             = boatState;
 }
Пример #3
0
 public GameState(State.People peopleState, int leftMissionaryNumber, int leftCannibalNumber, int boatMissionaryNumber, int boatCannibalNumber, int rightMissionaryNumber, int rightCannibalNumber, State.Boat boatState)
 {
     this.peopleState           = peopleState;
     this.leftMissionaryNumber  = leftMissionaryNumber;
     this.leftCannibalNumber    = leftCannibalNumber;
     this.boatMissionaryNumber  = boatMissionaryNumber;
     this.boatCannibalNumber    = boatCannibalNumber;
     this.rightMissionaryNumber = rightMissionaryNumber;
     this.rightCannibalNumber   = rightCannibalNumber;
     this.boatState             = boatState;
 }
Пример #4
0
    private void changeBoat(State.Boat boatState, int boatSpawnPoint)
    {
        var speed = GameObject.Find("/Managers/ProceedManager")
                    .GetComponent <ProceedManager>().speedSlider.value;

        // 방향 변경
        if (boatState == Boat.LEFT_R || boatState == Boat.FROM_LEFT_TO_RIGHT_R)
        {
            boat.localScale = new Vector3(2, 2, 1);
        }
        else
        {
            boat.localScale = new Vector3(-2, 2, 1);
        }
    }