public override void Start()
        {
            Instance = this;

            if (this.ColonistsData == null)
            {
                this.ColonistsData = new Dictionary <long, Dictionary <ProfessionType, Dictionary <string, Specialization> > >();
            }

            //Get all of the IDs of the current colonists
            HumanManager   humanManager = WorldScripts.Instance.humanManager;
            List <HumanAI> colonists    = humanManager.colonyFaction.GetLivingHumanoids().ToList();

            //Remove all of the saved IDs that are not in the colony anymore
            foreach (var removedId in this.ColonistsData.Keys.Where(x => !colonists.Any(y => y.GetID() == x)).ToArray())
            {
                this.ColonistsData.Remove(removedId);
            }

            //Init all of the IDs
            foreach (var colonist in colonists)
            {
                InitColonist(colonist);
            }

            MaxTreeWoodAmount = ModHandler.mods.furnitures.Values
                                .Where(x => x.modules.ContainsKey("resource"))
                                .Select(x => x.GetCachedModule <ResourceModule>())
                                .Where(x => x.GetResource() == Resource.Wood).Max(x => x.resourcesPerRound);
        }
Esempio n. 2
0
 public GameManager(GameObject go)
 {
     currentTime     = new TimeManager(go);
     humanManager    = new HumanManager();
     resourceManager = new ResourceManager();
     buildingManager = new BuildingManager();
 }
        public static bool ShowPrefix(BirthdayChildPanel __instance, HumanAI child)
        {
            Transform panel = __instance.transform.GetChild(0);

            if (panel.Find("ButtonContainer") == null)
            {
                PlannedParenthoodMod.SetupBirthdayPanel(__instance);
            }

            __instance.descriptionText.text = String.Format(Localization.GetText("witchy_PlannedParenthood_BirthdayPanelText"), child.father.GetFullName(), child.mother.GetFullName());

            String randomGirlName = HumanManager.GetRandomHumanNamePart(false, Gender.Female);
            String randomBoyName  = HumanManager.GetRandomHumanNamePart(false, Gender.Male);
            String lastName       = (UnityEngine.Random.Range(0f, 1f) < 0.5f) ? child.mother.lastName : child.father.lastName;

            panel.Find("GirlPanel").GetComponentInChildren <InputField>().text = $"{randomGirlName} {lastName}";
            panel.Find("BoyPanel").GetComponentInChildren <InputField>().text  = $"{randomBoyName} {lastName}";

            PlannedParenthoodMod.InputChanged(__instance);

            AccessTools.Field(typeof(BirthdayChildPanel), "child").SetValue(__instance, child);

            __instance.gameObject.SetActive(true);

            return(false);
        }
Esempio n. 4
0
        //一共俩份
        //private const int CreateNOModifyType = 0;//无
        //private const int CreateHumanModifyType = 1;//未入
        //private const int EntryHumanModifyType = 3;//入职
        //private const int BecomeHumanModifyType = 5;//转正
        //private const int LeaveHumanModifyType = 7;//离职


        public HumanInfoController(RestClient rsc, HumanInfoManager humanInfoManager, HumanManager human)
        {
            _humanManage      = human;
            _humanInfoManager = humanInfoManager;
            _lastNumber       = 0;
            _restClient       = rsc;
        }
Esempio n. 5
0
    void Start()
    {
        holder        = GameObject.Find("Top");
        otherSettings = GameObject.Find("Other");

        moversComponent = GameObject.Find("XZ").GetComponent <Movers>();

        humanManager = GameObject.Find("Humans").GetComponent <HumanManager>();
        slideManager = GameObject.Find("Slides").GetComponent <SlideManager>();

        lightsHolder = GameObject.Find("Lights");
        for (int i = 0; i < lightsHolder.transform.childCount; i++)
        {
            lightsHolder.transform.GetChild(i).gameObject.SetActive(false);
        }

        player = GameObject.Find("Player");

        settingsAll = Instantiate(toggler, new Vector3(0, 0, 0),
                                  Quaternion.Euler(-135, 0, 0), holder.transform) as GameObject;

        settingsAll.transform.localPosition = new Vector3(0, 1.5f, 0.3f);
        settingsAll.name = "Settings";

        settingsText      = settingsAll.transform.GetChild(0).transform.GetChild(0).GetComponent <TextMesh>();
        settingsText.text = "Баптамалар";
    }
        private bool ReadyForMigrant()
        {
            HumanManager hManager = WorldScripts.Instance.humanManager;

            return(hManager.AreExpectationsMet() &&
                   !hManager.HasTooManyColonists() &&
                   WorldScripts.Instance.furnitureFactory.GetModules <AttentionModule>().Any <AttentionModule>(x => x.lit));
        }
Esempio n. 7
0
 private void Start()
 {
     animator     = GetComponent <Animator>();
     humanManager = GetComponent <HumanManager>();
     cc           = GetComponent <CharacterController>();
     humanGrabing = GetComponent <HumanGrabing>();
     audioSource  = GetComponent <AudioSource>();
 }
Esempio n. 8
0
 private void Awake()
 {
     instance = this;
     nowStage = GetStage();
     line     = new List <HumanLine>(nowStage.humans);
     hManager = gameObject.AddComponent <HumanManager>();
     TimeManager.SetTime(1);
 }
Esempio n. 9
0
 void Start()
 {
     _nature           = HumanManager.Nature;
     _human            = _nature.HumanManager_Script;
     _time             = 0;
     _time_Bool        = false;
     _default_Position = transform.localPosition;
     _default_Rotation = transform.localEulerAngles;
 }
Esempio n. 10
0
    //==============================================================================//
    // 初期化																		//
    //==============================================================================//
    void Start()
    {
        MainCamera = GameObject.Find("Main Camera");
        GameStateManagerInstance   = GameObject.Find("GameManager").GetComponent <GameStateManager>();
        HumanManagerInstance       = GameObject.Find("DataManager").GetComponent <HumanManager>();
        ThroughHumanJudgerInstance = GameObject.Find("GameManager").GetComponent <ThroughHumanJudger>();
        HumanGenerateWaitTimer     = 100;

        setWallPrefabs();
    }
Esempio n. 11
0
 public void StartM()
 {
     // いろいろ取得
     camTr         = Camera.main.transform;
     controller    = GetComponent <CharacterController>();
     playerConfig  = Resources.Load <PlayerConfig>("PlayerConfigData");
     humanManager  = GetComponent <HumanManager>();
     humanAnimator = GetComponent <HumanAnimator>();
     humanGrabing  = GetComponent <HumanGrabing>();
 }
Esempio n. 12
0
        public static void Main(string[] args)
        {
            Console.Clear();
            if (args.Length != 1 || new string[] { "?", "help", "/help", "help?", "?help" }.Contains(args[0])) // new string[] { "?", "help", "/help", "help?", "?help" } is an array that contains all calls of "Help"
            {
                Console.WriteLine("This program requries only one argument - File Path.\nOutput is the set of records sorted in one of three ways.");
            }
            else
            {
                HumanManager humanManager = new HumanManager();
                try
                {
                    using (StreamReader sr = new StreamReader(args[0]))
                    {
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            var human = HumanParser.Parse(line);

                            if (human != null)
                            {
                                humanManager.AddHuman(human);
                            }
                            else
                            {
                                Console.WriteLine("Bad data.");
                                break;
                            }
                        }
                    }
                    int   option            = 0;
                    int[] acceptableChoices = new int[] { 1, 2, 3 };

                    while (!acceptableChoices.Contains(option))
                    {
                        Console.WriteLine("Please choose how you'd like to print result.\n1) Sorted by gender (females before males) then by last name ascending.\n2) Sorted by birth date, ascending.\n3) Sorted by last name, descending.");
                        Int32.TryParse(Console.ReadLine(), out option);
                    }
                    List <Human> resultList = humanManager.GetHumans((SortType)option);
                    foreach (var item in resultList)
                    {
                        Console.WriteLine($"{item.LastName} {item.FirstName} {item.Gender} {item.FavoriteColor} {String.Format("{0:d}", item.DateOfBirth)}");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Unable to open this file. Please, check the File Path.");
                }
            }
            Console.WriteLine("Please, press \"Enter\" key to exit ...");
            Console.ReadLine();
            return;
        }
Esempio n. 13
0
    public static void SpawnHuman_Postfix(HumanManager __instance, ref HumanAI __result, HumanConfiguration config, Vector3 position, Faction faction, bool alive = true, HumanAI.Serializable serial = null)
    {
        if (UIImprovementsMod.Instance == null || UIImprovementsMod.Instance.AnimalCyclerPanel == null)
        {
            return;
        }

        if (__result != null && __result.faction != null && !__result.IsHumanoid() && __result.animal != null && __result.faction is ColonyFaction)
        {
            HumanType type = __result.humanType;
            UIImprovementsMod.Instance.AnimalCyclerPanel.UpdateUI(type);
        }
    }
Esempio n. 14
0
    private void Start()
    {
        if (!manager)
        {
            manager = GameObject.FindGameObjectWithTag("Manager").GetComponent <HumanManager>();

            myRigidbody       = this.GetComponent <Rigidbody>();
            startingDirection = new Vector3(Random.Range(1, 3), 0, Random.Range(1, 3));
            //myRigidbody.velocity = startingDirection * speed;
            maxSpeed += Random.Range(-5, 5);
            manager.followers.Add(this);
        }
    }
    void ChangeItem(Collider other, HumanManager human, GameObject effect)
    {
        ItemState temp = ItemState.Null;

        switch (other.tag)
        {
        case "Dash":
            if (!ItemColliction.DeadDash.IsRun())
            {
                temp = ItemState.Dash;
            }
            else
            {
                temp = ItemState.DeadDash;
            }
            break;

        case "Double":
            temp = ItemState.Double;
            break;

        case "Protect":
            temp = ItemState.Protect;
            break;

        case "SuperMan":
            temp = ItemState.SuperMan;
            break;

        case "Magnet":
            temp = ItemState.Magnet;
            break;
        }
        if (temp == ItemState.Null)
        {
            return;
        }
        else
        {
            if (temp != ItemState.DeadDash)
            {
                human.ItemState = temp;
            }
            Effect(other, effect);
            StaticParameter.DestroyOrDespawn(other.transform);
        }
    }
        public static bool Prefix(HumanManager __instance, ref HumanAI __result, HumanConfiguration config, Vector3 position, Faction faction, bool alive = true, HumanAI.Serializable serial = null)
        {
            if (!PlannedParenthoodMod.InAddChild && config.humanType == HumanType.Colonist && config.ageLevel == AgeLevel.Child && serial == null)
            {
                PlannedParenthoodMod.InAddChild = true;

                GameObject fakeObj = new GameObject();
                fakeObj.SetActive(false);
                HumanMonoBehaviour hMono = fakeObj.AddComponent <HumanMonoBehaviour>();

                __result = new HumanAI(hMono, null, config, Int64.MaxValue);

                __result.mother.children.Remove(__result);
                __result.father.children.Remove(__result);
                return(false);
            }

            return(true);
        }
Esempio n. 17
0
        public void AddHumanTest()
        {
            Human testHuman = new Human
            {
                FirstName     = "John",
                LastName      = "Doe",
                FavoriteColor = Colors.Silver,
                DateOfBirth   = new DateTime(1995, 8, 22),
                Gender        = Genders.Male
            };

            HumanManager hm          = new HumanManager();
            List <Human> correctList = new List <Human> {
                testHuman
            };

            hm.Clear();
            hm.AddHuman(testHuman);

            var result = hm.GetHumans();

            if (result.Count == 0)
            {
                Assert.Fail();
            }

            bool invalidResult = false;

            for (int i = 0; i < result.Count && i < correctList.Count; i++)
            {
                if (!result[i].IsEqual(correctList[i]))
                {
                    invalidResult = true;
                    break;
                }
            }

            if (invalidResult)
            {
                Assert.Fail();
            }
        }
Esempio n. 18
0
        static void Main()
        {
            WorkManager  workManager  = new WorkManager();
            HumanManager humanManager = new HumanManager();
            bool         loop         = true;

            do
            {
                Console.Clear();
                Console.WriteLine("Wybierz akcje:");
                Console.WriteLine("1)Add Worker");
                Console.WriteLine("2)Add Work");
                Console.WriteLine("3)Show All Workers");
                Console.WriteLine("4)Show All Works");
                Console.WriteLine("5)Delete Worker");
                Console.WriteLine("6)Delete Work");
                Console.WriteLine("7)Add Worker to work");
                Console.WriteLine("8)Delete Worker");
                Console.WriteLine("9)show workers from 1 work");
                Console.WriteLine("10)end ");
                int.TryParse(Console.ReadLine(), out int choice);
                switch (choice)
                {
                case 1:
                    humanManager.AddNewHuman();         //wywołanie managera
                    break;

                case 2:
                    workManager.AddNewWork();           //wywołanie managera
                    break;

                case 3:
                    humanManager.ShowAllHumans();       //wywołanie managera
                    break;

                case 4:
                    workManager.ShowAllWorks();         //wywołanie managera
                    break;

                case 5:
                    int humanID = workManager.DeleteWorker();       //usunięcie pracownika i zwrócenie jego ID
                    humanManager.DeleteWork(humanID);               //usunięcie pracy u pracownika o danym ID
                    break;

                case 6:
                    Work work = workManager.DeleteWork();           //usunięcie pracy z listy i pobranie jej
                    humanManager.DeleteWork(work);                  //zmiana na bezrobotych osób pracujących w tej firmie
                    break;

                case 7:
                    humanManager.AddWork(workManager.GetWorkData());        //dodanie pracy pobranej z listy service i podanej przez manager
                    break;

                case 8:
                    humanManager.DeleteWork(workManager.DeleteWorker());    //usunięcie z pracy pracownika o danym id
                    break;

                case 9:
                    workManager.ShowAllWorkers();               //pokazanie wszystkich pracowników danego zakładu
                    break;

                case 10:
                    loop = false;                   //koniec pętli
                    break;

                default:
                    break;
                }
            } while (loop);
        }
Esempio n. 19
0
    // ------------------------*

    private void Awake()
    {
        instance = this;
    }
Esempio n. 20
0
        public readonly float                Right_Wide_Wall_Inside; //右侧宽墙内侧坐标

        #endregion

        //构造,给属性赋值
        public HumanNature(int mark)
        {
            _follow_Spring = new FollowSpring(false);

            //Debug.Log("属性初始化");
            HumanEvolution hero = FindObjectOfType <HumanEvolution>();

            //墙体属性
            HumanManager.WallMark = WallMark.Left;   //现在所处墙体的标记
            HumanManager.JumpMark = JumpMark.Normal; //跳跃类型标记

            var left_Wall       = MyFind(MyTags.Left_Tag, MyTags.Wall_Layer);
            var right_Wall      = MyFind(MyTags.Right_Tag, MyTags.Wall_Layer);
            var left_Wide_Wall  = MyFind(MyTags.Left_Tag, MyTags.Wide_Wall_Layer);
            var right_Wide_Wall = MyFind(MyTags.Right_Tag, MyTags.Wide_Wall_Layer);

            Left_Wall_Inside       = left_Wall.GetComponent <MeshRenderer>().bounds.max.x;
            Right_Wall_Inside      = right_Wall.GetComponent <MeshRenderer>().bounds.min.x;
            Left_Wide_Wall_Inside  = left_Wide_Wall.GetComponent <MeshRenderer>().bounds.max.x;
            Right_Wide_Wall_Inside = right_Wide_Wall.GetComponent <MeshRenderer>().bounds.min.x;
            //速度
            //Slope = hero.Slope; //斜率
            Jump_Speed = hero.Jump_Speed; //跳跃速度
            Run_Speed  = hero.Run_Speed;  //人物奔跑速度
            if (Jump_Speed == 0 || Run_Speed == 0)
            {
                Debug.Log("速度被赋值了0,自动赋值默认值");
                Jump_Speed = 14.0f * Time.fixedDeltaTime; //跳跃速度
                Run_Speed  = 5.5f * Time.fixedDeltaTime;  //人物奔跑速度
            }
            Slow_Speed = Run_Speed * 0.5f;                //减速后的速度
            //道具时间
            Dash_Time      = hero.Dash_Time;              //冲锋时间
            Double_Time    = hero.Double_Time;            //双倍时间
            Protect_Time   = hero.Protect_Time;           //护盾时间
            Super_Man_Time = hero.SuperMan_Time;          //无敌时间
            Magnet_Time    = hero.Magnet_Time;            //磁铁时间
            //人物相关属性
            Off_Set             = 0.1f;
            Skill_List          = hero.InherentSkillList;     //人物技能列表
            Buy_Items_List      = BuyTheItems.Buy_Items_List; //开局前购买的道具
            HumanManager_Script = FindObjectOfType <HumanManager>();
            Human_Script        = hero;
            Human             = hero.transform;
            Human_Ani         = Human.transform.GetComponent <Animator>();
            Main_Camera       = GameObject.FindGameObjectWithTag("MainCamera").transform;
            Difference_Y      = Main_Camera.position.y - Human.position.y; //人物和摄像机y轴上的初始位置差
            Human_Mesh        = GameObject.FindGameObjectWithTag("Player").GetComponent <SkinnedMeshRenderer>();
            Human_Shader      = Human_Mesh.material.shader;
            Human_Height      = Human_Mesh.bounds.extents.y;
            Human_Helf_Height = Human.position.x - Human_Mesh.bounds.min.x;
            Vector3 temp = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth * 0.5f,
                                                                      Camera.main.pixelHeight * 0.25f, Human.transform.position.z - Camera.main.transform.position.z));

            Human_Start_Position = new Vector3(Left_Wall_Inside + Human_Height * (0.5f - Off_Set), temp.y,
                                               left_Wall.transform.GetComponent <MeshRenderer>().bounds.center.z - 0.2f);
            End_Point     = GameObject.Find("EndPoint").transform.GetComponent <Renderer>();
            HumanCollider = Human.GetComponentInChildren <HumanColliderManager>();
            Normal_Angle  = HumanCollider.transform.localEulerAngles;
            if (Human_Ani == null)
            {
                Debug.Log("未找到动画组件");
            }

            Human_Phantom         = Human.GetComponent <Phantom>();
            Human_Phantom.enabled = false;
            ColliderManager       = GameObject.FindGameObjectWithTag("ColliderManager");
        }
Esempio n. 21
0
        public void GetHumansByGenderAndLastNameTest()
        {
            Human humanA = new Human
            {
                FirstName     = "Anna",
                LastName      = "Martin",
                FavoriteColor = Colors.Silver,
                DateOfBirth   = new DateTime(1995, 8, 22),
                Gender        = Genders.Female
            };
            Human humanB = new Human
            {
                FirstName     = "Caroline",
                LastName      = "Smith",
                FavoriteColor = Colors.Silver,
                DateOfBirth   = new DateTime(1995, 8, 22),
                Gender        = Genders.Female
            };
            Human humanC = new Human
            {
                FirstName     = "John",
                LastName      = "Doe",
                FavoriteColor = Colors.Silver,
                DateOfBirth   = new DateTime(1995, 8, 22),
                Gender        = Genders.Male
            };
            Human humanD = new Human
            {
                FirstName     = "Peter",
                LastName      = "Griffin",
                FavoriteColor = Colors.Silver,
                DateOfBirth   = new DateTime(1995, 8, 22),
                Gender        = Genders.Male
            };

            List <Human> correctList = new List <Human> {
                humanA, humanB, humanC, humanD
            };

            HumanManager hm = new HumanManager();

            hm.Clear();
            hm.AddHuman(humanD);
            hm.AddHuman(humanA);
            hm.AddHuman(humanC);
            hm.AddHuman(humanB);

            var result = hm.GetHumans(SortType.ByGenderAndLastName);

            bool invalidResult = false;

            for (int i = 0; i < result.Count && i < correctList.Count; i++)
            {
                if (!result[i].IsEqual(correctList[i]))
                {
                    invalidResult = true;
                    break;
                }
            }

            if (invalidResult)
            {
                Assert.Fail();
            }
        }
Esempio n. 22
0
 public RecordsController()
 {
     humanManager = new HumanManager();
 }
Esempio n. 23
0
 private void Start()
 {
     zombieManager = this.gameObject.GetComponent <ZombieFlockManager>();
     humanManager  = this.gameObject.GetComponent <HumanManager>();
 }
Esempio n. 24
0
 public void OnEnter()
 {
     _human_Script = _human.GetComponent <HumanManager>();
     _human_Ani.SetInteger(StaticParameter.Ani_Key_HumanState, 0);
 }
 public HumanFileController(RestClient rsc, HumanManager human)
 {
     _humanManage = human;
     _restClient  = rsc;
 }
Esempio n. 26
0
    //切换函数
    void ChangeState(float times, float jump_Frames, float x_Wall_Inside_Left, float x_Wall_Inside_Right, HumanManager human)
    {
        if (jump_Frames - times < 0)
        {
            JumpEnd();
        }

        switch (HumanManager.WallMark)
        {
        case WallMark.Left:
            if (HumanManager.Nature.Human_Mesh.bounds.center.x + 1.2f <= x_Wall_Inside_Left)
            {
                JumpEnd();
            }
            break;

        case WallMark.Right:
            if (HumanManager.Nature.Human_Mesh.bounds.center.x - 1.2f >= x_Wall_Inside_Right)
            {
                JumpEnd();
            }
            break;
        }
    }