Beispiel #1
0
    public Clone()
    {
        int numberOfWardrobeTypes = System.Enum.GetValues(typeof(WardrobeManager.WardrobeType)).Length;

        sex    = Wardrobe.GenerateRandomSex();
        seed   = Wardrobe.GenerateRandomSeed();
        nameId = IdentityManager.GetRandomNameID(sex);
        int typeNo = UnityEngine.Random.Range(0, numberOfWardrobeTypes);

        wType = (WardrobeManager.WardrobeType)typeNo;
    }
Beispiel #2
0
    /// <summary>
    /// Called once per frame.
    /// </summary>
    public void Update()
    {
        if (Manager.Get().GameInProgress)
        {
            if (Input.GetKeyDown(KeyCode.M))
            {
                foreach (AgentAI a in AgentAI.GetAgents())
                {
                    if (a.IsSelected())
                    {
                        if (CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex == WardrobeManager.Sex.Female)
                        {
                            CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex = WardrobeManager.Sex.Male;
                        }
                        else
                        {
                            CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex = WardrobeManager.Sex.Female;
                        }
                        //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed -= 10;
                        RespawnAgent(a);
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.End))
            {
                string info = "";
                int    n    = 0;
                foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents())
                {
                    //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = teamSeeds[n];
                    clones[n].ApplyClone(a.CurrentCloneableId);
                    RespawnAgent(a);

                    if (info != "")
                    {
                        info += "\n";
                    }
                    info += a.AgentClassName() + " got " + clones[n].GetInfo();
                    n++;
                }
                setEntityInfo("Agent Clone Data applied", info);
            }

            if (Input.GetKeyDown(KeyCode.Home))
            {
                string info = "";
                int    n    = 0;
                foreach (AgentAI a in AgentAI.GetAgents())
                {
                    //copyClone(CloneManager.Get().GetCloneableData(a.CurrentCloneableId), ref clones[n]);
                    teamSeeds[n] = CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed;
                    if (clones.Length != 5)
                    {
                        clones = new Clone[5];
                    }
                    clones[n] = new Clone(a.CurrentCloneableId);
                    if (info != "")
                    {
                        info += "\n";
                    }
                    info += a.AgentClassName() + " info: " + clones[n].GetInfo();
                    n++;
                }
                setEntityInfo("Agent Clone Data Stored", info);
            }

            if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad1))
            {
                memSet(1);
            }
            else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad2))
            {
                memSet(2);
            }
            else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad4))
            {
                memGet(1);
            }
            else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad5))
            {
                memGet(2);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad1))
            {
                memSet(1);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad2))
            {
                memSet(2);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad3))
            {
                memSet(3);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad4))
            {
                memGet(1);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad5))
            {
                memGet(2);
            }
            else if (Input.GetKeyDown(KeyCode.Keypad6))
            {
                memGet(3);
            }

            if (Input.GetKeyDown(KeyCode.Keypad8))
            {
                string info = "";
                foreach (AgentAI a in AgentAI.GetAgents())
                {
                    if (a.IsSelected())
                    {
                        int numberOfWardrobeTypes = System.Enum.GetValues(typeof(WardrobeManager.WardrobeType)).Length;
                        int typeNo = UnityEngine.Random.Range(0, numberOfWardrobeTypes);
                        WardrobeManager.WardrobeType wType = (WardrobeManager.WardrobeType)typeNo;
                        //a.name = "Caldor";
                        //a.InitRandomSeed();
                        //a.m_Identity.NameID = IdentityManager.GetRandomNameID(CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex);
                        CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = Wardrobe.GenerateRandomSeed();
                        a.m_Wardrobe.m_Sex          = Wardrobe.GenerateRandomSex();
                        a.m_Wardrobe.m_WardrobeType = wType;
                        //a.m_Wardrobe.bod = Wardrobe.CreateRandomBodyData();
                        Wardrobe.BodyData body = a.m_Wardrobe.GetBodyData();
                        //body.m_HairColor1 = Color.yellow;
                        //body.m_HairColor2 = Color.green;
                        //body.m_LowerPrimaryColor = Color.red;
                        //body.m_LowerSecondaryColor = Color.red;
                        //body.m_SkinColor = Color.blue;
                        //a.m_Wardrobe.SetBodyData(body, a.m_Wardrobe.m_Sex, a.m_Wardrobe.RandomSeed, a.m_Wardrobe.m_WardrobeType);
                        RespawnAgent(a);

                        info += "Hair:" + body.m_HairColor1.ToString() + " & " + body.m_HairColor2.ToString() + ". skin: " + body.m_SkinColor.ToString();
                    }
                }
                setEntityInfo("Randomized", info);
            }

            if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad9))
            {
                int numberOfWardrobeTypes = System.Enum.GetValues(typeof(WardrobeManager.WardrobeType)).Length;
                int typeNo = UnityEngine.Random.Range(0, numberOfWardrobeTypes);
                WardrobeManager.WardrobeType wType = (WardrobeManager.WardrobeType)typeNo;
                foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents())
                {
                    a.m_Wardrobe.m_WardrobeType = wType;
                    RespawnAgent(a);
                }
            }
            else if (Input.GetKeyDown(KeyCode.Keypad9))
            {
                string info = "";
                string first; string last;
                foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents()) //AgentAI.GetAgents())
                {
                    int           nameId        = IdentityManager.GetRandomNameID(a.m_Wardrobe.m_Sex);
                    int           currentNameId = Mathf.RoundToInt(a.CurrentCloneableId);
                    int           cloneId       = a.CurrentCloneableId;
                    CloneableData cData         = CloneManager.Get().GetCloneableData(cloneId);
                    IdentityManager.Get().GetName(cData.IdentityId, out first, out last);
                    info += "Name based on identity Id: " + cData.IdentityId + " is " + first + " " + last + "\n";
                    //info += "Clonable name: " + a.GetCloneable().name + "\n";
                    info += currentNameId + ": " + first + " " + last;
                    IdentityManager.Get().GetName(cData.m_IdentityID, out first, out last);
                    //a.m_Identity.NameID = nameId;
                    //a.m_Wardrobe.m_WardrobeType = WardrobeManager.WardrobeType.AgentSupportBacker;
                    info += " changing name To " + nameId + ": " + first + " " + last + "\n";
                    Manager.GetUIManager().ShowMessagePopup(info, 6);
                    cData.IdentityId   = nameId;
                    cData.m_IdentityID = nameId;
                    //cData.WardrobeType = WardrobeManager.WardrobeType.Prostitute2;

                    //a.name = "Caldor";
                    //a.InitRandomSeed();
                    //a.m_Identity.NameID = IdentityManager.GetRandomNameID(CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex);
                    //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = Wardrobe.GenerateRandomSeed();
                    //a.m_Wardrobe.m_Sex = WardrobeManager.Sex.Male;
                    //a.m_Wardrobe.bod = Wardrobe.CreateRandomBodyData();
                    Wardrobe.BodyData body = a.m_Wardrobe.GetBodyData();
                    //body.m_HairColor1 = Color.black;
                    //body.m_HairColor2 = Color.black;
                    //body.m_LowerPrimaryColor = Color.black;
                    //body.m_LowerSecondaryColor = Color.black;
                    //body.m_SkinColor = Color.black;

                    //a.m_Wardrobe.SetBodyData(body, a.m_Wardrobe.m_Sex, a.m_Wardrobe.RandomSeed, a.m_Wardrobe.m_WardrobeType);
                    RespawnAgent(a);

                    info += a.AgentClassName() + " got Hair: " + body.m_HairColor1 + " & " + body.m_HairColor1 + ".\nskin: " + body.m_SkinColor;
                    info += "\nWardrope type: " + a.m_Wardrobe.m_WardrobeType + "\n";
                }
                setEntityInfo("Selected agent", info);
            }



            if (Input.GetKeyDown(KeyCode.Keypad0))
            {
                string  info = "";
                string  first; string last;
                AgentAI a = AgentAI.FirstSelectedAgentAi();
                if (a != null)
                {
                    int           cloneId = a.CurrentCloneableId;
                    CloneableData cData   = CloneManager.Get().GetCloneableData(cloneId);
                    IdentityManager.Get().GetName(cData.IdentityId, out first, out last);

                    info += "Selected person is " + first + " " + last + ", gender " + cData.Sex;
                    info += ". Seed is:" + cData.RandomSeed + ", mSeed is:" + cData.m_RandomSeed + " and wardrobe type is " + cData.WardrobeType;
                    info += ". Palette: " + cData.WardrobeConfigurationData.m_DefaultColorPaletteName;
                }
                else
                {
                    foreach (AIEntity ae in AIEntity.FindObjectsOfType(typeof(AIEntity)))
                    {
                        if (ae.IsSelected())
                        {
                            ae.m_IsControllable = true;
                            IdentityManager.Get().GetName(ae.m_Identity.NameID, out first, out last);
                            info += "Selected person is " + first + " " + last + ", gender " + ae.m_Wardrobe.m_Sex;
                            info += ". Seed is:" + ae.m_Wardrobe.RandomSeed + " Wardrobe type is " + ae.m_Wardrobe.m_WardrobeType;
                            info += ". Palette: " + ae.m_Wardrobe.DefaultColorPaletteName;
                            break;
                        }
                    }
                }
                setEntityInfo("Selected AI info", info);
            }
        }
    }