Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        meshIdToObject = new Dictionary <int, MeshedSkeleton> ();
        mutantsCount   = new Dictionary <int, int> ();
        mutants        = new List <MeshedSkeleton> ();
        mainObjects    = new List <MeshedSkeleton> ();
        //skeleton = Resources.Load ("Skeleton2") as GameObject;
        //skeleton = Resources.Load ("SkeletonTree") as GameObject;
        //skeleton = Resources.Load ("Trident") as GameObject;
        //GameObject skeleton = Resources.Load ("ArmMotion") as GameObject;
        //skeleton = Resources.Load ("HumanoidMotion") as GameObject;
        //GameObject skeleton = Resources.Load ("HumanoidArmBetter") as GameObject;
        //GameObject skeleton = Resources.Load ("Arm") as GameObject;
        //GameObject skeleton = Resources.Load ("PigLeg") as GameObject;
        //GameObject skeleton = Resources.Load ("Generated/OriginalSkeleton-404478") as GameObject;
        //GameObject skeleton = Resources.Load ("BodyTest3") as GameObject;
        //GameObject skeleton = Resources.Load ("Generated/Animal1") as GameObject;
        List <GameObject> prefabs = new List <GameObject>()
        {
            Resources.Load("TestFullBody2") as GameObject,
            Resources.Load("TestFullBody") as GameObject,
            Resources.Load("Generated/Animal1") as GameObject,
            Resources.Load("Arm") as GameObject,
            Resources.Load("PigLeg") as GameObject
        };

        //GameObject skeleton = Resources.Load ("Generated/Bodies/OriginalSkeleton-3482408") as GameObject;

        this.containerRotation = new Vector3(-75, 0, 0);
        int index = 0;

        foreach (GameObject prefab in prefabs)
        {
            GameObject container = new GameObject("SkeletonContainer" + prefab.GetInstanceID().ToString());
            //container.transform.Rotate (this.containerRotation);
            //container.transform.localEulerAngles = (this.containerRotation);
            GameObject     go = (GameObject)Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
            MeshedSkeleton ms = new MeshedSkeleton(container, new Vector3(0, index * 20, 0), go, meshIdToObject, false, false);
            mainObjects.Add(ms);
            mutantsCount.Add(ms.getMeshId(), 1);
            index++;
        }

        mainObjects [0].toggleSelected();

        meshUp = GameObject.Find("MeshUp").GetComponent <Button>();
        meshUp.onClick.AddListener(() => { meshUpPress(); });

        mutate = GameObject.Find("Mutate").GetComponent <Button> ();
        mutate.onClick.AddListener(() => { mutatePress(); });


        mutate = GameObject.Find("Save").GetComponent <Button> ();
        mutate.onClick.AddListener(() => { savePress(); });

        spheresVisible = true;
        //meshVisible = false;

        //meshIdToObject.Add (this.mainObject.getMeshId (), this.mainObject);
    }
Ejemplo n.º 2
0
    void mutatePress()
    {
        Debug.Log("mutate");
        this.mutationCount++;

        //Mutation objMutation = new Mutation (this.mainObject.getGameObject(), 0.8f, 0.9f, 0.9f, 20f);
        List <MeshedSkeleton> originals = this.getSelectedObjects();

        SkeletonMutation skeletonMutation = new SkeletonMutation(originals, 0.2f);
        GameObject       localContainer   = new GameObject("SkeletonContainer" + this.mutationCount.ToString());
        //localContainer.transform.Rotate (this.containerRotation);
        //localContainer.transform.RotateAround (this.transform.position, Vector3.left, 75);
        //localContainer.transform.localEulerAngles = (this.containerRotation);
        int currId = originals[0].getMeshId();
        int cnt    = this.mutantsCount[currId];

        this.mutantsCount.Remove(currId);
        this.mutantsCount.Add(currId, cnt + 1);
        Vector3        positionOnScreen = originals[0].getPositionOnScreen() + new Vector3(0, 0, 10 * cnt);
        MeshedSkeleton currMutant       = new MeshedSkeleton(localContainer, positionOnScreen, skeletonMutation, meshIdToObject, false);

        mutants.Add(currMutant);
    }