コード例 #1
0
    void GenerateUMA()
    {
        GameObject myUMA = new GameObject("MyUMA");
        avatar = myUMA.AddComponent<UMADynamicAvatar>();

        avatar.Initialize();
        umaData = avatar.umaData;
        avatar.umaGenerator = generator;
        umaData.umaGenerator = generator;
        umaData.umaRecipe = new UMAData.UMARecipe();
        umaData.umaRecipe.slotDataList = new SlotData[NUM_SLOTS];

        umaDna = new UMADnaHumanoid();
        umaTutorialDna = new UMADnaTutorial();
        
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDna);

        

        CreateMale();

        avatar.animationController = animController;

        avatar.UpdateNewRace();

        myUMA.transform.parent = this.gameObject.transform;
        myUMA.transform.localPosition = Vector3.zero;
        myUMA.transform.localRotation = Quaternion.identity;
    }
コード例 #2
0
    void GenerateUMA()
    {
        // Create a new game object and add UMA components to it
        GameObject GO = new GameObject("MyUMA");
        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();

        // Initialise Avatar and grab a reference to it's data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        // Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        // Set up slot Array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        // Set up our Morph reference
        umaDna = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDNA);

        // Grab a reference to our recipe
        // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale

        // >>> This is whee the fun will happen according to Secret Anorak <<<<
        CreateMale();

        // Generate Our UMA
        umaDynamicAvatar.UpdateNewRace();
    }
コード例 #3
0
ファイル: UMAMaker.cs プロジェクト: yunspace/UMATutorial
    public void Initialize(UMADiAvatar.Factory avatarGOFactory,
		UMADnaHumanoid dna, UMADnaTutorial tutorial)
    {
        this.avatarGOFactory = avatarGOFactory;
        this.umaDna = dna;
        this.umaTutorialDna = tutorial;
        GenerateUMA();
    }
コード例 #4
0
    void GenerateUMA()
    {
        //Create a new game object and add UMA components to it
        GameObject GO = new GameObject ("MyUMA");
        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();

        //Initialise Avatar and grab a refrence to its data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        //Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        //Setup slot array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        //Set up our morph refrence
        umaDNA = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna (umaDNA);
        umaData.umaRecipe.AddDna (umaTutorialDNA);

        //----------UMA Generation Section-----------------
        CreateMale();

        umaDynamicAvatar.animationController = animController;

        //Generate our UMA
        umaDynamicAvatar.UpdateNewRace();

        GO.transform.parent = this.gameObject.transform;
        GO.transform.localPosition = Vector3.zero;
        GO.transform.localRotation = Quaternion.identity;
    }
コード例 #5
0
    void GenerateUMA()
    {
        // Create a new game object and add UMA components to it
        GameObject GO = new GameObject("MyUMA");
        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();

        // Initialise Avatar and grab a reference to it's data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s
        umaData.OnCharacterCreated += CharacterCreatedCallback;

        // Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        // Set up slot Array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        // Set up our Morph reference
        umaDna = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDNA);

        // Grab a reference to our recipe
        // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale

        // >>> This is where the fun will happen according to Secret Anorak <<<<
        CreateFemale();

        // dynamic animation controller
        umaDynamicAvatar.animationController = animController;

        // Generate Our UMA
        umaDynamicAvatar.UpdateNewRace();
    }
コード例 #6
0
ファイル: UMACustomization.cs プロジェクト: NotYours180/UMA
    // Set the camera target and viewport
    private void SetCamera(bool show)
    {
//        Camera cam = cameraTrack.GetComponent<Camera>();
        if(show)
        {
            Camera.main.rect = ViewPortReduced;
            DnaPanel.SetActive(true);
            DnaHide.gameObject.SetActive(true);
#if UNITY_5 && !UNITY_5_1 && !UNITY_5_0
			// really Unity? Yes we change the value and set it back to trigger a ui recalculation... 
			// because setting the damn game object active doesn't do that!
			var rt = DnaPanel.GetComponent<RectTransform>();
			var pos = rt.offsetMin;
			rt.offsetMin = new Vector2(pos.x + 1, pos.y);
			rt.offsetMin = pos;
#endif
		}
        else
        {
            cameraTrack.target = baseTarget;
            Camera.main.rect = ViewPortFull;
            DnaPanel.SetActive(false);
			DnaHide.gameObject.SetActive(false);
			umaData = null;
			umaDna = null;
			umaTutorialDna = null;
		}
    }
コード例 #7
0
ファイル: UMACustomization.cs プロジェクト: NotYours180/UMA
    // An avatar has been selected, setup the camera, sliders, retarget the camera, and adjust the viewport
    // to account for the DNA slider scroll panel
	public void AvatarSetup()
	{
		umaDynamicAvatar = umaData.gameObject.GetComponent<UMADynamicAvatar>();
		
		if(cameraTrack){
			cameraTrack.target = umaData.umaRoot.transform;
		}
		
		umaDna = umaData.GetDna<UMADnaHumanoid>();
		umaTutorialDna = umaData.GetDna<UMADnaTutorial>();

        SetSliders();
        SetCamera(true);
	}
コード例 #8
0
    void GenerateUMA()
    {
        // Create a new game object and add UMA components to it
        GameObject GO = new GameObject("MyUMA");
        // parent the new uma into the host game object
        GO.transform.parent = this.gameObject.transform;
        GO.transform.localPosition = Vector3.zero;
        GO.transform.localRotation = Quaternion.identity;

        GO.AddComponent(typeof(NavMeshAgent));
        GO.AddComponent(typeof(CapsuleCollider));
        var goCol = GO.GetComponent<CapsuleCollider>();
        goCol.center = new Vector3(0f, 0.78f, 0f);
        goCol.height = 1.7f;
        goCol.radius = 0.33f;
        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();

        // Initialise Avatar and grab a reference to it's data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s
        umaData.OnCharacterCreated += CharacterCreatedCallback;

        // Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        // Set up slot Array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        // Set up our Morph reference
        umaDna = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDNA);

        // Grab a reference to our recipe
        // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale

        // >>> This is whee the fun will happen according to Secret Anorak <<<<
        CreateMale();

        // dynamic animation controller
        umaDynamicAvatar.animationController = animController;

        // Generate Our UMA
        umaDynamicAvatar.UpdateNewRace();
    }
コード例 #9
0
    void GenerateUMA()
    {
        //UMA naming
        // Check a list of UMA objects.

        int umaCount = GameObject.FindGameObjectsWithTag("UMA").Length;
        UMAName = "UMA_" + umaCount.ToString();

        // Create a new game object and add UMA components to it
        GameObject GO = new GameObject("myUMA");
        GO.tag = "UMA";
        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();

        // Initialise Avatar and grab a reference to it's data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s
        umaData.OnCharacterCreated += CharacterCreatedCallback;

        // Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        // Set up slot Array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        // Set up our Morph reference
        umaDna = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDNA);

        // Grab a reference to our recipe
        // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale

        // >>> This is whee the fun will happen according to Secret Anorak <<<<
        CreateMale();

        // dynamic animation controller
        umaDynamicAvatar.animationController = animController;

        // Generate Our UMA
        umaDynamicAvatar.UpdateNewRace();

        // parent the new uma into the host game object
        GO.transform.parent = this.gameObject.transform;
        GO.transform.localPosition = Vector3.zero;
        GO.transform.localRotation = Quaternion.identity;
    }
コード例 #10
0
ファイル: UMACharGen.cs プロジェクト: thetobinator/udg2
    GameObject GenerateUMA(string name)
    {
        // Create a new game object and add UMA components to it

        GameObject GO = new GameObject(name);
        GO.transform.position = this.transform.position;
        //parentAtPosition(GO);

        umaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();
        umaDynamicAvatar.animationController = animationController;
        GO.AddComponent<RagdollCreatorTest>();
        if (name.Contains ("Zombie")) {

            ZombieBehavior zbh = GO.AddComponent<ZombieBehavior> ();
            zbh.speedMultiplier = Random.Range (0.5f, 2.5f);
            GO.tag = "Zombie";
            GameObject[] zombies = GameObject.FindGameObjectsWithTag("Zombie");
            GO.name = "Zombie" + zombies.Length;

        } else {
            HumanBehavior hb = GO.AddComponent<HumanBehavior> ();
            hb.zombieAnimationController = secondaryAnimationController;
            GO.tag = "Human";
          //  GameObject[] humans = GameObject.FindGameObjectsWithTag("Human");
            //GO.name = "Human" + humans.Length;

        }

        GO.AddComponent<NavMeshAgent> ();
        GO.AddComponent<HealthComponent> ();

        // Initialize Avatar and grab a reference to its data component
        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        // Attach our generator
        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        // Set up slot Array
        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        // Set up our Morph references
        umaDna = new UMADnaHumanoid();
        umaTutorialDNA = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDna);
        umaData.umaRecipe.AddDna(umaTutorialDNA);

        if (name.Contains ("Female")) {
            CreateFemale ();
        } else {
            CreateMale ();

        }

        // Generate our UMA
        setupDna (umaDna);
        umaDynamicAvatar.UpdateNewRace();

        if (name.Contains("Human"))
        {
            if (name.Contains("Female"))
            {
                GO.name = createName("Female");
            }
            else
            {
              GO.name = createName("Male");
            }
        }

        return GO;
    }
コード例 #11
0
ファイル: UMACustomization.cs プロジェクト: BillDStrong/UMA
    // Set the camera target and viewport
    private void SetCamera(bool show)
    {
        //        Camera cam = cameraTrack.GetComponent<Camera>();
        if(show)
        {
            Camera.main.rect = ViewPortReduced;
            DnaPanel.SetActive(true);
            DnaHide.gameObject.SetActive(true);
        }

        else
        {
            cameraTrack.target = baseTarget;
            Camera.main.rect = ViewPortFull;
            DnaPanel.SetActive(false);
            DnaHide.gameObject.SetActive(false);
            umaData = null;
            umaDna = null;
            umaTutorialDna = null;
        }
    }