Exemplo n.º 1
0
    // Start is called before the first frame update
    void Awake()
    {
        MyCoroutines = new List <Func <string, CharacterAnimatorController, IEnumerator> >();


        Func <string, CharacterAnimatorController, IEnumerator> F1 = new Func <string, CharacterAnimatorController, IEnumerator>(DoTheAnim);
        Func <string, CharacterAnimatorController, IEnumerator> F2 = new Func <string, CharacterAnimatorController, IEnumerator>(DoTheAnimwait);

        FA1 = new Func <Vector3, string, Action, CharacterAnimatorController, IEnumerator>(DoTheRot);
        MyCoroutines.Add(F1);
        MyCoroutines.Add(F2);
        _dwellerItemManager = DwellerObj.GetComponent <CharacterItemManager>();
        _bellhopItemManager = BellHopObj.GetComponent <CharacterItemManager>();

        _dwellerAnimatorController = DwellerObj.GetComponent <CharacterAnimatorController>();
        _bellhopAnimatorController = BellHopObj.GetComponent <CharacterAnimatorController>();



        GameObject   Item_a = Instantiate(Items[UnityEngine.Random.Range(3, Items.Count)].gameObject);
        DeliveryItem Di_a   = Item_a.GetComponent <DeliveryItem>();
        GameObject   Item_b = Instantiate(Items[UnityEngine.Random.Range(0, 3)].gameObject);
        DeliveryItem Di_b   = Item_b.GetComponent <DeliveryItem>();
        GameObject   Item_c = Instantiate(Items[UnityEngine.Random.Range(3, Items.Count)].gameObject);
        DeliveryItem Di_c   = Item_c.GetComponent <DeliveryItem>();

        //Test_AttachItem(Di_a, AnimalCharacterHands.Right, _bellhopItemManager);
        //Test_Show_LR(true, AnimalCharacterHands.Right, _bellhopItemManager);

        Test_AttachItem(Di_b, AnimalCharacterHands.Right, _dwellerItemManager);
        Test_Show_LR(true, AnimalCharacterHands.Right, _dwellerItemManager);

        //Test_AttachItem(Di_c, AnimalCharacterHands.Left, _dwellerItemManager);
        //Test_Show_LR(true, AnimalCharacterHands.Left, _dwellerItemManager);

        // target = targ3.transform;
        // StartCoroutine(FA1(target.position, "Wave2", () => print("hi"), _dwellerAnimatorController));
        //_bellhopAnimatorController.ActivateAgent();
        //_dwellerAnimatorController.ActivateAgent();
        //  _bellhopAnimatorController.WarpMeAgentto(targ4.transform);
    }
Exemplo n.º 2
0
 void Test_Show_LR(bool argshow, AnimalCharacterHands argLR, CharacterItemManager arggItemmanager)
 {
     arggItemmanager.Show_LR(argshow, argLR);
 }
Exemplo n.º 3
0
    //private void Awake()
    //{
    //    _gs = GameSettings.Instance;
    //    if (_gs == null) { Debug.LogError("SceneBuilder: No GameSettings in scene!"); }
    //}
    // Start is called before the first frame update
    void Start()

    {
        _gs = GameSettings.Instance;

        if (_gs == null)
        {
            Debug.LogError("SceneBuilder: No GameSettings in scene!");
        }


        Dict_BoyNames  = new Dictionary <char, List <string> >();
        Dict_GirlNames = new Dictionary <char, List <string> >();
        Dict_ItemNames = new Dictionary <char, List <string> >();
        DICT_MASTER    = new Dictionary <string, ListManager>();

        DeliveryItem_Instances           = new List <GameObject>();
        Dwellers_Instances               = new List <GameObject>();
        BOYS_AvailableDynamicAnimalNames = Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList();

        GIRLS_AvailableDynamicAnimalNames = Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList();

        for (int x = 0; x < Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList().Count; x++)
        {
            BOYS_AvailableDynamicAnimalNames[x]  = "Mr." + BOYS_AvailableDynamicAnimalNames[x];
            GIRLS_AvailableDynamicAnimalNames[x] = "Mrs." + GIRLS_AvailableDynamicAnimalNames[x];
            //BOYS_AvailableDynamicAnimalNames[x] = BOYS_AvailableDynamicAnimalNames[x];
            //GIRLS_AvailableDynamicAnimalNames[x] = GIRLS_AvailableDynamicAnimalNames[x];
        }

        SelectedAnimalNames.AddRange(BOYS_AvailableDynamicAnimalNames);

        SelectedAnimalNames.AddRange(GIRLS_AvailableDynamicAnimalNames);

        SelectedAnimalNames.Shuffle();

        BoyNamescsv  = Resources.Load("Data/BoyNames237") as TextAsset;
        GirlNamescsv = Resources.Load("Data/GirlNames323") as TextAsset;

        MakeDictionaries(BoysSplitCsvGrid, BoyNamescsv, Dict_BoyNames);
        MakeDictionaries(GirlsSplitCsvGrid, GirlNamescsv, Dict_GirlNames);

        for (int x = 0; x < Enum.GetNames(typeof(GameEnums.MyItems)).ToList().Count; x++)
        {
            string itemname = ((GameEnums.MyItems)x).ToString().ToLower();
            char   c        = itemname[0];

            if (Dict_ItemNames.ContainsKey(c))
            {
                Dict_ItemNames[c].Add(itemname);
            }
            else
            {
                Dict_ItemNames.Add(c, new List <string>()
                {
                    itemname
                });
            }
        }

        CreateRandDwellerAndItemPath();

        LoadedDeliveryItemObjs = Resources.LoadAll <GameObject>("Items/NiceConstructedObjects").ToList();

        List <string> temp = SelectedAnimalNames.Take <string>(_gs.Master_Number_of_Floors).ToList();

        SelectedAnimalNames = temp;

        HashSet <char> UniqueCharToUse = new HashSet <char>();



        foreach (string s in SelectedAnimalNames)
        {
            string[] words = s.Split('.');
            UniqueCharToUse.Add(words[1][0]);
        }

        foreach (char c in UniqueCharToUse)
        {
            Dict_BoyNames[c].Shuffle();
            Dict_GirlNames[c].Shuffle();
            Dict_ItemNames[c].Shuffle();
        }

        //create MAster Dictionary based on selected animals



        for (int M = 0; M < SelectedAnimalNames.Count; M++)
        {
            string name      = SelectedAnimalNames[M];
            char   c         = name.Split('.')[1][0];
            string MasterKEY = (name.Split('.')[0].Length == 3) ? "g." : "b.";  //  Mr.Rabbit  => b.r

            MasterKEY = MasterKEY + c;
#if DebugOn
            Debug.Log(SelectedAnimalNames[M] + " " + " " + name.Split('.')[1] + " " + MasterKEY);
#endif

            if (!DICT_MASTER.ContainsKey(MasterKEY))
            {
                ListManager Lm = new ListManager();
                if (MasterKEY[0] == 'b')
                {
                    Lm.AssignList(Dict_BoyNames[c]);
                }
                else if (MasterKEY[0] == 'g')
                {
                    Lm.AssignList(Dict_GirlNames[c]);
                }


                DICT_MASTER.Add(MasterKEY, Lm);
            }



            // add item names to master dictionary

            string MasterItemKEY = "i." + c;  //  i.r



            if (!DICT_MASTER.ContainsKey(MasterItemKEY))
            {
                ListManager Lmi = new ListManager();
                if (Dict_ItemNames[c] != null)
                {
                    Lmi.AssignList(Dict_ItemNames[c]);  // rope, root, roller
                    DICT_MASTER.Add(MasterItemKEY, Lmi);
                }
            }
        }


        Hotel = new GameObject();
        Hotel.transform.position = new Vector3(0, 0, 0);
        Hotel.name = "Hotel";
#if DebugOn
        Debug.Log("-----------------------");
#endif

        for (int i = 0; i < _gs.Master_Number_of_Floors; i++)
        {
            GameObject FloorObjectInstance = Instantiate(FloorObjRef);
            FloorObjectInstance.name = "floor_" + i;
            FloorObjectInstance.transform.position = new Vector3(FloorObjectInstance.transform.position.x, i * _gs.Master_Floor_Height, FloorObjectInstance.transform.position.z);



            HotelFloor _holtelfloorOfInstance = FloorObjectInstance.GetComponent <HotelFloor>();
            _holtelfloorOfInstance.FloorNumber = i;
            _holtelfloorOfInstance.EarlyBuildFurniture();


            GameObject Dweller = Instantiate(BaseAnimalRef, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0));

            DwellerMeshComposer dmc = Dweller.GetComponent <DwellerMeshComposer>();
            dmc.Id = i;


            string searchkey;
            string ItemSearchKey;
            string name1 = SelectedAnimalNames[i];
            Dweller.name = name1;
            char c = name1.Split('.')[1][0];
            searchkey = (name1.Split('.')[0].Length == 3) ? "g." : "b.";  //  Mr.Rabbit  => b.r

            if (searchkey == "b.")
            {
                dmc.Gender = GameEnums.Gender.Mr;
            }
            else
            {
                dmc.Gender = GameEnums.Gender.Mrs;
            }

            searchkey     = searchkey + c;
            ItemSearchKey = "i." + c;

            string       animalName = SelectedAnimalNames[i].Split('.')[1];
            GameObject   objRef     = GetItemRefBySimpleName(DICT_MASTER[ItemSearchKey].NextItem());
            DeliveryItem di         = objRef.GetComponent <DeliveryItem>();
            di.SetOwner(dmc);
            TempListToBeShifted.Add(objRef);
#if DebugOn
            Debug.Log(SelectedAnimalNames[i] + " " + " " + animalName + "  -> " + objRef.name);
#endif
            GameEnums.DynAnimal a = (GameEnums.DynAnimal)Enum.Parse(typeof(GameEnums.DynAnimal), animalName);

            dmc.Make(a, DICT_MASTER[searchkey].NextItem());

            Dwellers_Instances.Add(Dweller);

            FloorObjectInstance.transform.parent = Hotel.transform;
            HotelAsListOfFloors.Add(_holtelfloorOfInstance);
        }


        GameObject firstislast = TempListToBeShifted[0];
        for (int x = 1; x < TempListToBeShifted.Count; x++)
        {
            DeliveryItem_Instances.Add(Instantiate(TempListToBeShifted[x]));
        }
        DeliveryItem_Instances.Add(Instantiate(firstislast));



        //now assign the objs and the animals and the floors
        for (int p = 0; p < path.Length; p++)
        {
            int floortosetup        = path[p];
            DwellerMeshComposer dmc = Dwellers_Instances[p].GetComponent <DwellerMeshComposer>();


            dmc.MyFinalResidenceFloorNumber = floortosetup;
            CharacterItemManager Cim = Dwellers_Instances[p].GetComponent <CharacterItemManager>();
            DeliveryItem         Di  = DeliveryItem_Instances[p].GetComponent <DeliveryItem>();
            Cim.AttachItem(Di, AnimalCharacterHands.Right);
            Cim.Show_LR(false, AnimalCharacterHands.Right);


            HotelAsListOfFloors[floortosetup].SetDweller(Dwellers_Instances[p]);
        }


        GameObject tempBEllHop = Instantiate(Hop, camlobby.BellHopLobbyPosTan.position, Quaternion.identity);



        HotelFloorsMNG.InitializeFLoors(HotelAsListOfFloors);
        GameFlow.InitializeMyThings(tempBEllHop.GetComponent <AnimalCentralCommand>(), HotelFloorsMNG, camlobby, BellhopCocation, SessionMNGR, StoryTextGen);
        camlobby.assignBunny(Hop);

        camlobby.SetInitialPos(HotelAsListOfFloors[_gs.Master_Number_of_Floors - 1].BaseCamPos.transform);
    }
Exemplo n.º 4
0
 void Test_AttachItem(DeliveryItem Di, AnimalCharacterHands argLR, CharacterItemManager arggItemmanager)
 {
     arggItemmanager.AttachItem(Di, argLR);
 }
Exemplo n.º 5
0
    void Make_newSystem(SequenceType argSequenceType, int argwrons)
    {
        BellHopGameEventManager.Instance.Call_DebugThis("w=" + argwrons.ToString() + " " + argSequenceType.ToString());


        TaskSys = new BHG_TaskSystem();
        _gs     = GameSettings.Instance;

        W_D_ExchandePos       = new TA_DwellerWarp(_Dweller, _exhangeI.GetActionPos());
        W_D_MAinRoomActionPos = new TA_DwellerWarp(_Dweller, _mainRoomActionI.GetActionPos());
        W_D_DancePos          = new TA_DwellerWarp(_Dweller, _danceI.GetActionPos());
        W_D_SpawnPos          = new TA_DwellerWarp(_Dweller, _spawnI.GetActionPos());

        M_D_ExchandePos       = new TA_DwellerMoveTo(_Dweller, _exhangeI.GetActionPos());
        M_D_MainRoomActionPos = new TA_DwellerMoveTo(_Dweller, _mainRoomActionI.GetActionPos());
        M_D_DancePos          = new TA_DwellerMoveTo(_Dweller, _danceI.GetActionPos());
        M_D_Outdoors          = new TA_DwellerMoveTo(_Dweller, _outDoorsPlace);
        F_D_Cam  = new TA_DwellerFace(_Dweller, Camera.main.transform);
        F_B_Cam  = new TA_DwellerFace(_Bellhop, Camera.main.transform);
        F_D_Bell = new TA_DwellerFace(_Dweller, _Bellhop.transform);
        F_D_MainRoomActionLookat = new TA_DwellerFace(_Dweller, _mainRoomActionI.GetLookTarg());
        F_B_Dweller     = new TA_DwellerFace(_Bellhop, _Dweller.transform);
        F_D_SpawnLookat = new TA_DwellerFace(_Dweller, _spawnI.GetLookTarg());
        //dweller pulls to his left AKA good delivery
        P_B_2R = new TA_DwellerPullCoord_2R(_Bellhop, _Dweller);
        P_D_2L = new TA_DwellerPullCoord_2L(_Dweller, _Bellhop);


        A_D_Wave1          = new TA_DwellerAnimate(_Dweller, _gs.Wave1);
        A_D_Wave2          = new TA_DwellerAnimate(_Dweller, _gs.Wave2);
        A_D_Hello          = new TA_DwellerAnimate(_Dweller, _gs.Hello);
        A_D_No             = new TA_DwellerAnimate(_Dweller, _gs.No);
        A_D_Good           = new TA_DwellerAnimate(_Dweller, _gs.Good);
        A_B_Good           = new TA_DwellerAnimate(_Bellhop, _gs.Good);
        A_D_MainRoomAction = new TA_DwellerAnimate(_Dweller, _mainRoomActionI.argActionString);
        A_D_Toss           = new TA_DwellerAnimate(_Dweller, _gs.Toss);
        A_B_Toss           = new TA_DwellerAnimate(_Bellhop, _gs.Toss);
        I_D_showRight      = new TA_InstantTaskHandShowHide(_Dweller, GameEnums.AnimalCharacterHands.Right, true);
        I_D_HideLeft       = new TA_InstantTaskHandShowHide(_Dweller, GameEnums.AnimalCharacterHands.Left, false);

        F_B_Cam = new TA_DwellerFace(_Bellhop, Camera.main.transform);

        O_DoorsNow           = new TA_TimedOpenDoor();
        T_moveOn             = new TA_MoveOnTrig(_Dweller, 4f);
        T_GG                 = new TA_GameOver();
        Sequence_SimpleGreet = new List <ITaskAction>
        {
            W_D_ExchandePos,
            M_D_ExchandePos,
            I_D_showRight,
            F_D_Bell,
            F_B_Dweller,
            A_D_Toss,
            P_B_2R,
            M_D_DancePos,
            F_D_Cam,
            F_D_Bell,
            F_B_Dweller,
            A_B_Toss,
            P_D_2L,
            F_B_Cam
        };


        Sequence_U_FIRST = new List <ITaskAction>   {
            W_D_MAinRoomActionPos,
            T_moveOn,
            F_D_MainRoomActionLookat,
            O_DoorsNow,
            A_D_MainRoomAction,
            F_D_Bell,
            M_D_ExchandePos,

            I_D_showRight,
            F_D_Bell,
            F_B_Dweller,
            A_D_Toss, //needed for pull mirorred character
            P_B_2R,
            F_D_Cam,
            F_B_Cam,
        };
        Sequence_U_Long_goodfloor = new List <ITaskAction>   {
            W_D_MAinRoomActionPos,
            T_moveOn,
            F_D_MainRoomActionLookat,
            O_DoorsNow,
            A_D_MainRoomAction,
            F_D_Bell,
            M_D_ExchandePos,
            I_D_showRight,
            F_B_Dweller,
            F_D_Bell,
            A_D_Hello,
            A_B_Toss, //needed for pull mirorred character
            P_D_2L,
            A_D_Good,
            I_D_HideLeft,
            I_D_showRight,
            A_D_Toss,
            P_B_2R,
            F_B_Cam,
        };

        Sequence_U_short_goodfloor = new List <ITaskAction>   {
            W_D_ExchandePos,
            I_D_showRight,
            O_DoorsNow,
            F_B_Dweller,
            F_D_Bell,
            M_D_ExchandePos,
            F_B_Dweller,
            F_D_Bell,
            A_B_Toss, //needed for pull mirorred character
            P_D_2L,
            A_D_Good,
            I_D_HideLeft,
            I_D_showRight,
            A_D_Toss,
            P_B_2R,
            F_B_Cam,
        };


        Sequence_U_goodfloor_fromSpaw = new List <ITaskAction>   {
            W_D_SpawnPos,
            F_D_SpawnLookat,
            I_D_showRight,
            O_DoorsNow,
            M_D_ExchandePos,

            F_B_Dweller,
            F_D_Bell,
            A_D_Hello,
            A_B_Toss, //needed for pull mirorred character
            P_D_2L,
            A_D_Good,
            I_D_HideLeft,
            I_D_showRight,
            A_D_Toss,
            P_B_2R,
            F_B_Cam,
        };

        Sequence_U_GameOver = new List <ITaskAction>   {
            W_D_MAinRoomActionPos,
            T_moveOn,
            F_D_MainRoomActionLookat,
            O_DoorsNow,
            A_D_MainRoomAction, //is running right after roomlookat , and hopes to get exited on time by O_DOOrnow
            F_D_Bell,
            A_D_Hello,
            A_B_Toss, //needed for pull mirorred character

            A_D_Good,
            A_B_Good,
            I_D_HideLeft,



            F_B_Cam,
            T_GG,
        };

        Sequence_U_WrongFloorLONG_walk = new List <ITaskAction>   {
            W_D_SpawnPos,
            F_D_SpawnLookat,
            O_DoorsNow,
            M_D_Outdoors,
            //    M_D_ExchandePos,
            F_B_Dweller,
            F_D_Bell,
            A_D_No,

            F_B_Cam,
            M_D_ExchandePos,
            F_D_Cam,
        };


        Sequence_Exc_DwellerToss1way_end = new List <ITaskAction>   {
            W_D_ExchandePos,
            O_DoorsNow,
            M_D_ExchandePos,
            F_D_Bell,
            F_B_Dweller,
            I_D_showRight,
            A_D_Toss, //needed for pull mirorred character
            P_B_2R,
            F_D_Cam,
            F_B_Cam,
        };
        Sequence_WrongFloor_Short = new List <ITaskAction>   {
            W_D_ExchandePos,

            O_DoorsNow,
            F_B_Dweller,
            F_D_Bell,
            A_D_No,

            F_B_Cam,
        };
        Sequence_WrongFloorLONG = new List <ITaskAction>   {
            //W_D_SpawnPos,
            //F_D_SpawnLookat,

            //O_DoorsNow,
            //M_D_ExchandePos,
            //F_B_Dweller,
            //F_D_Bell,
            //A_D_No,

            F_B_Cam,
        };



        if (argwrons == 0)
        {
            REF_correct = Sequence_U_short_goodfloor;
            REF_Wrong   = Sequence_WrongFloor_Short;
        }
        else

        if (argwrons == 1)
        {
            REF_correct = Sequence_U_Long_goodfloor;
            REF_Wrong   = Sequence_U_WrongFloorLONG_walk;
        }
        else
        {
            REF_correct = Sequence_U_goodfloor_fromSpaw;
            REF_Wrong   = Sequence_U_WrongFloorLONG_walk;
        }



        if (argSequenceType == SequenceType.sq_FIRST)
        {
            Setup_Tasksystem(Sequence_U_FIRST);
        }
        else

        if (argSequenceType == SequenceType.sq_correct)
        {
            Setup_Tasksystem(REF_correct);
        }
        else
        if (argSequenceType == SequenceType.sq_GameOver)
        {
            Setup_Tasksystem(Sequence_U_GameOver);
        }
        else

        if (argSequenceType == SequenceType.sq_wrong)
        {
            Setup_Tasksystem(REF_Wrong);
        }
        else
        {
            Setup_Tasksystem(Sequence_WrongFloor_Short);
        }



        CharacterItemManager cim = _Dweller.GetComponent <CharacterItemManager>();

        if (cim != null)
        {
            cim.Show_LR(false, GameEnums.AnimalCharacterHands.Left);
        }
        else
        {
            Debug.LogError("NO ItemMAnager ");
        }
    }