Ejemplo n.º 1
0
    public void memSet(int n)
    {
        int   seed = 0;
        Clone c    = null;

        foreach (AgentAI a in AgentAI.GetAgents())
        {
            if (a.IsSelected() && (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)))
            {
                nameIDs[n] = a.m_Identity.NameID;
            }
            else if (a.IsSelected())
            {
                c    = new Clone(a.CurrentCloneableId);
                seed = c.seed;
            }
        }
        //CloneableData data = null;
        if (seed != 0)
        {
            seedMem[n] = seed;
        }
        else
        {
            foreach (AIEntity ae in AIEntity.FindObjectsOfType(typeof(AIEntity)))
            {
                //if (a.IsSelected())
                //    seedMem[n] = a.GetComponent<CloneableData>().RandomSeed;
                //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed;
                if (ae.IsSelected() && (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)))
                {
                    nameIDs[n] = ae.m_Identity.NameID;
                }
                else if (ae.IsSelected())
                {
                    c    = new Clone(ae);
                    seed = ae.m_Wardrobe.RandomSeed;
                    //w = new Wardrobe();
                    //w.CopyFrom(a.m_Wardrobe);

                    //data = CloneManager.Get().NewCloneableFromPrefab(a);
                    //if (a.GetComponentInParent<CloneableData>() != null)
                    //    seed = a.GetCloneable().GetComponentInParent<CloneableData>().m_RandomSeed;
                    //if (a.GetComponent<CloneableData>() != null)
                    //    seed = a.GetComponent<CloneableData>().m_RandomSeed;
                    //if (a.GetCloneable().GetComponentInChildren<CloneableData>() != null)
                    //    seed = a.GetCloneable().GetComponentInChildren<CloneableData>().m_RandomSeed;
                    //if (seed == 0)
                    //    seed = data.m_RandomSeed;
                }
            }
        }
        if (seed != 0)
        {
            seedMem[n] = seed;
        }
        string info = "Seed: " + seed;

        if (c != null)
        {
            cloneMem[n] = c;
            Manager.GetUIManager().ShowMessagePopup(info + " saved into " + n, 8);
            setEntityInfo("Seed saved into " + n, info);
        }
        else if (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl) && nameIDs[n] != 0)
        {
            string first; string last;
            IdentityManager.Get().GetName(nameIDs[n], out first, out last);
            Manager.GetUIManager().ShowMessagePopup("NameId:" + nameIDs[n] + " put in nameId mem slot " + n + ", name " + first + " " + last, 8);
        }
        else
        {
            Manager.GetUIManager().ShowMessagePopup("Cannot store a clone in slot " + n + " if no clonable person is selected.", 8);
        }
    }