public void OutCitizenCreate(Citizen citizen, Building building)
    {
        Citizen_Type type = citizen.citizen_Type;

        string citizenPath = "InGame/Citizen/";

        switch (type)
        {
        case Citizen_Type.Normal:
            citizenPath += "Normal_Citizen"; break;

        case Citizen_Type.Young:
            citizenPath += "Young_Citizen"; break;

        case Citizen_Type.Old:
            citizenPath += "Old_Citizen"; break;

        case Citizen_Type.The:
            citizenPath += "The_Citizen"; break;
        }

        Citizen citizenOBJ = Instantiate(Resources.Load <Citizen>(citizenPath), citizenParant.transform);

        citizenOBJ.home = citizen.home;

        Tile tile = tiles[(int)building.tile.pos.x, (int)building.tile.pos.y - 1];

        citizenOBJ.Init(this, tile);
        citizenOBJ.ChangeColor(citizen.citizen_color);

        citizenList.Add(citizenOBJ);
    }
    public Citizen CitizenCreate(CitizenSaveData citizen)
    {
        Citizen_Type type = citizen.citizen_Type;

        string citizenPath = "InGame/Citizen/";

        switch (type)
        {
        case Citizen_Type.Normal:
            citizenPath += "Normal_Citizen"; break;

        case Citizen_Type.Young:
            citizenPath += "Young_Citizen"; break;

        case Citizen_Type.Old:
            citizenPath += "Old_Citizen"; break;

        case Citizen_Type.The:
            citizenPath += "The_Citizen"; break;
        }

        Citizen citizenOBJ = Instantiate(Resources.Load <Citizen>(citizenPath), citizenParant.transform);
        Tile    editorTile = tiles[(int)citizen.pos.x, (int)citizen.pos.y];

        citizenOBJ.Init(this, editorTile);
        citizenOBJ.ChangeColor(citizen.citizenColor);

        citizenList.Add(citizenOBJ);

        return(citizenOBJ);
    }
Exemplo n.º 3
0
    public void SetState(CleanerState cleanerState)
    {
        this.cleanerState = cleanerState;

        if (cleanerState == CleanerState.Cleaning)
        {
            takeTime = 0;
        }
        else if (cleanerState == CleanerState.CleaningEnd)
        {
            citizen.cleanerOn = false;

            Tile tile = GameManager.Ins.tileController.tiles[0, 4];

            //var tile = GameObject.FindObjectOfType<TileController>().tiles[0, 4];
            //citizen.transform.position = tile.transform.position;
            //citizen.pos = tile.pos;

            citizen.gameObject.SetActive(true);
            citizen.ChangeColor(CitizenColor.White);
            citizen.ResetPos(tile);
            citizen.GoHome();



            //citizen.StartFSM();

            /*
             * if (citizen.Home != null)
             * {
             *  citizen.SetCitizenHome(citizen.Home);
             * }
             * else
             * {
             *  citizen.ChangePattern();
             * }
             */

            citizen      = null;
            cleanerState = CleanerState.Idle;
        }
    }