UnityEngine.Object.Instantiate(UnityEngine.Object)

Here are the examples of the csharp api UnityEngine.Object.Instantiate(UnityEngine.Object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

315 Examples 7

19 Source : GraphScenePrefabs.cs
with Apache License 2.0
from activey

public GameObject InstantiateNode()
		{
			GameObject node = Instantiate (NodePrefab);
			node.transform.SetParent (transform);
			return node;
		}

19 Source : GraphScenePrefabs.cs
with Apache License 2.0
from activey

public GameObject InstantiateEdge()
		{
			GameObject edge = Instantiate (EdgePrefab);
			edge.transform.SetParent (transform);
			return edge;
		}

19 Source : AnarchyManager.cs
with GNU General Public License v3.0
from aelariane

private IEnumerator OnGameWasOpened()
        {
            var back = new GameObject("TempBackground").AddComponent<BackgroundOnStart>();
            yield return StartCoroutine(Anarchyreplacedets.LoadreplacedetBundle());
            Instantiate(Anarchyreplacedets.Load("UIManager"));
            Instantiate(Anarchyreplacedets.Load("LoadScreen"));
            Destroy(back);
        }

19 Source : CharacterMaterials.cs
with GNU General Public License v3.0
from aelariane

public static void Init()
    {
        if (initialized)
        {
            return;
        }
        initialized = true;
        Materials = new Dictionary<string, Material>();
        NewMaterial("AOTTG_HERO_3DMG");
        NewMaterial("aottg_hero_AHSS_3dmg");
        NewMaterial("aottg_hero_annie_cap_causal");
        NewMaterial("aottg_hero_annie_cap_uniform");
        NewMaterial("aottg_hero_brand_sc");
        NewMaterial("aottg_hero_brand_mp");
        NewMaterial("aottg_hero_brand_g");
        NewMaterial("aottg_hero_brand_ts");
        NewMaterial("aottg_hero_skin_1");
        NewMaterial("aottg_hero_skin_2");
        NewMaterial("aottg_hero_skin_3");
        NewMaterial("aottg_hero_casual_fa_1");
        NewMaterial("aottg_hero_casual_fa_2");
        NewMaterial("aottg_hero_casual_fa_3");
        NewMaterial("aottg_hero_casual_fb_1");
        NewMaterial("aottg_hero_casual_fb_2");
        NewMaterial("aottg_hero_casual_ma_1");
        NewMaterial("aottg_hero_casual_ma_1_ahss");
        NewMaterial("aottg_hero_casual_ma_2");
        NewMaterial("aottg_hero_casual_ma_3");
        NewMaterial("aottg_hero_casual_mb_1");
        NewMaterial("aottg_hero_casual_mb_2");
        NewMaterial("aottg_hero_casual_mb_3");
        NewMaterial("aottg_hero_casual_mb_4");
        NewMaterial("aottg_hero_uniform_fa_1");
        NewMaterial("aottg_hero_uniform_fa_2");
        NewMaterial("aottg_hero_uniform_fa_3");
        NewMaterial("aottg_hero_uniform_fb_1");
        NewMaterial("aottg_hero_uniform_fb_2");
        NewMaterial("aottg_hero_uniform_ma_1");
        NewMaterial("aottg_hero_uniform_ma_2");
        NewMaterial("aottg_hero_uniform_ma_3");
        NewMaterial("aottg_hero_uniform_mb_1");
        NewMaterial("aottg_hero_uniform_mb_2");
        NewMaterial("aottg_hero_uniform_mb_3");
        NewMaterial("aottg_hero_uniform_mb_4");
        NewMaterial("hair_annie");
        NewMaterial("hair_armin");
        NewMaterial("hair_boy1");
        NewMaterial("hair_boy2");
        NewMaterial("hair_boy3");
        NewMaterial("hair_boy4");
        NewMaterial("hair_eren");
        NewMaterial("hair_girl1");
        NewMaterial("hair_girl2");
        NewMaterial("hair_girl3");
        NewMaterial("hair_girl4");
        NewMaterial("hair_girl5");
        NewMaterial("hair_hanji");
        NewMaterial("hair_jean");
        NewMaterial("hair_levi");
        NewMaterial("hair_marco");
        NewMaterial("hair_mike");
        NewMaterial("hair_petra");
        NewMaterial("hair_rico");
        NewMaterial("hair_sasha");
        NewMaterial("hair_mikasa");
        Texture mainTexture = (Texture)Object.Instantiate(Resources.Load("NewTexture/aottg_hero_eyes"));
        Material material = (Material)Object.Instantiate(Resources.Load("NewTexture/MaterialGLreplaced"));
        material.mainTexture = mainTexture;
        Materials.Add("aottg_hero_eyes", material);
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void Create3DMG()
    {
        UnityEngine.Object.Destroy(this.part_3dmg);
        UnityEngine.Object.Destroy(this.part_3dmg_belt);
        UnityEngine.Object.Destroy(this.part_3dmg_gas_l);
        UnityEngine.Object.Destroy(this.part_3dmg_gas_r);
        UnityEngine.Object.Destroy(this.part_blade_l);
        UnityEngine.Object.Destroy(this.part_blade_r);
        if (this.myCostume.mesh_3dmg.Length > 0)
        {
            this.part_3dmg = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg));
            this.part_3dmg.transform.position = this.mount_3dmg.transform.position;
            this.part_3dmg.transform.rotation = this.mount_3dmg.transform.rotation;
            this.part_3dmg.transform.parent = this.mount_3dmg.transform.parent;
            this.part_3dmg.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
        }
        if (this.myCostume.mesh_3dmg_belt.Length > 0)
        {
            this.part_3dmg_belt = this.GenerateCloth(this.reference, "Character/" + this.myCostume.mesh_3dmg_belt);
            this.part_3dmg_belt.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
        }
        if (this.myCostume.mesh_3dmg_gas_l.Length > 0)
        {
            this.part_3dmg_gas_l = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg_gas_l));
            if (this.myCostume.uniform_type != UNIFORM_TYPE.CasualAHSS)
            {
                this.part_3dmg_gas_l.transform.position = this.mount_3dmg_gas_l.transform.position;
                this.part_3dmg_gas_l.transform.rotation = this.mount_3dmg_gas_l.transform.rotation;
                this.part_3dmg_gas_l.transform.parent = this.mount_3dmg_gas_l.transform.parent;
            }
            else
            {
                this.part_3dmg_gas_l.transform.position = this.mount_3dmg_gun_mag_l.transform.position;
                this.part_3dmg_gas_l.transform.rotation = this.mount_3dmg_gun_mag_l.transform.rotation;
                this.part_3dmg_gas_l.transform.parent = this.mount_3dmg_gun_mag_l.transform.parent;
            }
            this.part_3dmg_gas_l.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
        }
        if (this.myCostume.mesh_3dmg_gas_r.Length > 0)
        {
            this.part_3dmg_gas_r = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg_gas_r));
            if (this.myCostume.uniform_type != UNIFORM_TYPE.CasualAHSS)
            {
                this.part_3dmg_gas_r.transform.position = this.mount_3dmg_gas_r.transform.position;
                this.part_3dmg_gas_r.transform.rotation = this.mount_3dmg_gas_r.transform.rotation;
                this.part_3dmg_gas_r.transform.parent = this.mount_3dmg_gas_r.transform.parent;
            }
            else
            {
                this.part_3dmg_gas_r.transform.position = this.mount_3dmg_gun_mag_r.transform.position;
                this.part_3dmg_gas_r.transform.rotation = this.mount_3dmg_gun_mag_r.transform.rotation;
                this.part_3dmg_gas_r.transform.parent = this.mount_3dmg_gun_mag_r.transform.parent;
            }
            this.part_3dmg_gas_r.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
        }
        if (this.myCostume.weapon_l_mesh.Length > 0)
        {
            this.part_blade_l = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.weapon_l_mesh));
            this.part_blade_l.transform.position = this.mount_weapon_l.transform.position;
            this.part_blade_l.transform.rotation = this.mount_weapon_l.transform.rotation;
            this.part_blade_l.transform.parent = this.mount_weapon_l.transform.parent;
            this.part_blade_l.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
            if (this.part_blade_l.transform.Find("X-WeaponTrailA"))
            {
                this.part_blade_l.transform.Find("X-WeaponTrailA").GetComponent<XWeaponTrail>().Deactivate();
                this.part_blade_l.transform.Find("X-WeaponTrailB").GetComponent<XWeaponTrail>().Deactivate();
                if (base.gameObject.GetComponent<HERO>())
                {
                    base.gameObject.GetComponent<HERO>().leftbladetrail = this.part_blade_l.transform.Find("X-WeaponTrailA").GetComponent<XWeaponTrail>();
                    base.gameObject.GetComponent<HERO>().leftbladetrail2 = this.part_blade_l.transform.Find("X-WeaponTrailB").GetComponent<XWeaponTrail>();
                }
            }
        }
        if (this.myCostume.weapon_r_mesh.Length > 0)
        {
            this.part_blade_r = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.weapon_r_mesh));
            this.part_blade_r.transform.position = this.mount_weapon_r.transform.position;
            this.part_blade_r.transform.rotation = this.mount_weapon_r.transform.rotation;
            this.part_blade_r.transform.parent = this.mount_weapon_r.transform.parent;
            this.part_blade_r.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
            if (this.part_blade_r.transform.Find("X-WeaponTrailA"))
            {
                this.part_blade_r.transform.Find("X-WeaponTrailA").GetComponent<XWeaponTrail>().Deactivate();
                this.part_blade_r.transform.Find("X-WeaponTrailB").GetComponent<XWeaponTrail>().Deactivate();
                if (base.gameObject.GetComponent<HERO>())
                {
                    base.gameObject.GetComponent<HERO>().rightbladetrail = this.part_blade_r.transform.Find("X-WeaponTrailA").GetComponent<XWeaponTrail>();
                    base.gameObject.GetComponent<HERO>().rightbladetrail2 = this.part_blade_r.transform.Find("X-WeaponTrailB").GetComponent<XWeaponTrail>();
                }
            }
        }
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateGlreplaced()
    {
        this.part_glreplaced = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/glreplaced"));
        this.part_glreplaced.transform.position = this.part_head.transform.position;
        this.part_glreplaced.transform.rotation = this.part_head.transform.rotation;
        this.part_glreplaced.transform.parent = baseT.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
    }

19 Source : CharacterMaterials.cs
with GNU General Public License v3.0
from aelariane

private static void NewMaterial(string pref)
    {
        Texture mainTexture = (Texture)Object.Instantiate(Resources.Load("NewTexture/" + pref));
        Material material = (Material)Object.Instantiate(Resources.Load("NewTexture/MaterialCharacter"));
        material.mainTexture = mainTexture;
        Materials.Add(pref, material);
    }

19 Source : ClothFactory.cs
with GNU General Public License v3.0
from aelariane

private static GameObject GenerateCloth(GameObject go, string res)
    {
        bool flag = go.GetComponent<SkinnedMeshRenderer>() == null;
        if (flag)
        {
            go.AddComponent<SkinnedMeshRenderer>();
        }
        Transform[] bones = go.GetComponent<SkinnedMeshRenderer>().bones;
        SkinnedMeshRenderer component = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load(res))).GetComponent<SkinnedMeshRenderer>();
        component.transform.localScale = Vector3.one;
        component.bones = bones;
        component.quality = SkinQuality.Bone4;
        return component.gameObject;
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

private GameObject GenerateCloth(GameObject go, string res)
    {
        if (!go.GetComponent<SkinnedMeshRenderer>())
        {
            go.AddComponent<SkinnedMeshRenderer>();
        }
        SkinnedMeshRenderer component = go.GetComponent<SkinnedMeshRenderer>();
        Transform[] bones = component.bones;
        SkinnedMeshRenderer component2 = ((GameObject)UnityEngine.Object.Instantiate(CacheResources.Load(res))).GetComponent<SkinnedMeshRenderer>();
        component2.gameObject.transform.parent = component.gameObject.transform.parent;
        component2.transform.localPosition = Vectors.zero;
        component2.transform.localScale = Vectors.one;
        component2.bones = bones;
        component2.quality = SkinQuality.Auto;
        return component2.gameObject;
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateFace()
    {
        this.part_face = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/character_face"));
        this.part_face.transform.position = this.part_head.transform.position;
        this.part_face.transform.rotation = this.part_head.transform.rotation;
        this.part_face.transform.parent = baseT.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateHair()
    {
        UnityEngine.Object.Destroy(this.part_hair);
        if (!this.IsDeadBody)
        {
            ClothFactory.DisposeObject(this.part_hair_1);
        }
        if (this.myCostume.hair_mesh != string.Empty)
        {
            this.part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.hair_mesh));
            this.part_hair.transform.position = this.part_head.transform.position;
            this.part_hair.transform.rotation = this.part_head.transform.rotation;
            this.part_hair.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
            this.part_hair.renderer.material = CharacterMaterials.Materials[this.myCostume.hairInfo.texture];
            this.part_hair.renderer.material.color = this.myCostume.hair_color;
        }
        if (this.myCostume.hair_1_mesh.Length > 0 && !this.IsDeadBody)
        {
            string name = "Character/" + this.myCostume.hair_1_mesh;
            Material material = CharacterMaterials.Materials[this.myCostume.hairInfo.texture];
            this.part_hair_1 = ClothFactory.GetHair(this.reference, name, material, this.myCostume.hair_color);
        }
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateUpperBody()
    {
        UnityEngine.Object.Destroy(this.part_upper_body);
        UnityEngine.Object.Destroy(this.part_brand_1);
        UnityEngine.Object.Destroy(this.part_brand_2);
        UnityEngine.Object.Destroy(this.part_brand_3);
        UnityEngine.Object.Destroy(this.part_brand_4);
        UnityEngine.Object.Destroy(this.part_chest_1);
        UnityEngine.Object.Destroy(this.part_chest_2);
        if (!this.IsDeadBody)
        {
            ClothFactory.DisposeObject(this.part_chest_3);
        }
        this.CreateCape();
        if (this.myCostume.part_chest_object_mesh.Length > 0)
        {
            this.part_chest_1 = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.part_chest_object_mesh));
            this.part_chest_1.transform.position = this.chest_info.transform.position;
            this.part_chest_1.transform.rotation = this.chest_info.transform.rotation;
            this.part_chest_1.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
            this.part_chest_1.renderer.material = CharacterMaterials.Materials[this.myCostume.part_chest_object_texture];
        }
        if (this.myCostume.part_chest_1_object_mesh.Length > 0)
        {
            this.part_chest_2 = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.part_chest_1_object_mesh));
            this.part_chest_2.transform.position = this.chest_info.transform.position;
            this.part_chest_2.transform.rotation = this.chest_info.transform.rotation;
            this.part_chest_2.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
            this.part_chest_2.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
            this.part_chest_2.renderer.material = CharacterMaterials.Materials[this.myCostume.part_chest_1_object_texture];
        }
        if (this.myCostume.part_chest_skinned_cloth_mesh.Length > 0 && !this.IsDeadBody)
        {
            this.part_chest_3 = ClothFactory.GetCape(this.reference, "Character/" + this.myCostume.part_chest_skinned_cloth_mesh, CharacterMaterials.Materials[this.myCostume.part_chest_skinned_cloth_texture]);
        }
        if (this.myCostume.body_mesh.Length > 0)
        {
            this.part_upper_body = this.GenerateCloth(this.reference, "Character/" + this.myCostume.body_mesh);
            this.part_upper_body.renderer.material = CharacterMaterials.Materials[this.myCostume.body_texture];
        }
        if (this.myCostume.brand1_mesh.Length > 0)
        {
            this.part_brand_1 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand1_mesh);
            this.part_brand_1.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
        }
        if (this.myCostume.brand2_mesh.Length > 0)
        {
            this.part_brand_2 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand2_mesh);
            this.part_brand_2.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
        }
        if (this.myCostume.brand3_mesh.Length > 0)
        {
            this.part_brand_3 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand3_mesh);
            this.part_brand_3.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
        }
        if (this.myCostume.brand4_mesh.Length > 0)
        {
            this.part_brand_4 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand4_mesh);
            this.part_brand_4.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
        }
        this.part_head.renderer.material = CharacterMaterials.Materials[this.myCostume.skin_texture];
        this.part_chest.renderer.material = CharacterMaterials.Materials[this.myCostume.skin_texture];
    }

19 Source : TITAN_SETUP.cs
with GNU General Public License v3.0
from aelariane

private void ApplyHairSkin(int hair, int eye, string hairlink)
    {
        Destroy(this.part_hair);
        this.hair = CostumeHair.hairsM[hair];
        this.hairType = hair;
        if (this.hair.hair != string.Empty)
        {
            part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
            part_hair.transform.parent = this.hair_go_ref.transform.parent;
            part_hair.transform.position = this.hair_go_ref.transform.position;
            part_hair.transform.rotation = this.hair_go_ref.transform.rotation;
            part_hair.transform.localScale = this.hair_go_ref.transform.localScale;
            part_hair.renderer.material = CharacterMaterials.Materials[this.hair.texture];
        }
        if (hairSkin != null)
        {
            hairSkin = new Anarchy.Skins.replacedans.replacedanSkinHair(part_hair, hairlink);
        }
        Anarchy.Skins.Skin.Check(hairSkin, new string[] { hairlink });
        this.setFacialTexture(this.eye, eye);
    }

19 Source : TITAN_SETUP.cs
with GNU General Public License v3.0
from aelariane

[RPC]
    private void setHairPRC(int type, int eye_type, float c1, float c2, float c3)
    {
        UnityEngine.Object.Destroy(this.part_hair);
        this.hair = CostumeHair.hairsM[type];
        this.hairType = type;
        if (this.hair.hair != string.Empty)
        {
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
            gameObject.transform.parent = this.hair_go_ref.transform.parent;
            gameObject.transform.position = this.hair_go_ref.transform.position;
            gameObject.transform.rotation = this.hair_go_ref.transform.rotation;
            gameObject.transform.localScale = this.hair_go_ref.transform.localScale;
            gameObject.renderer.material = CharacterMaterials.Materials[this.hair.texture];
            gameObject.renderer.material.color = new Color(c1, c2, c3);
            this.part_hair = gameObject;
        }
        this.setFacialTexture(this.eye, eye_type);
    }

19 Source : Bullet.cs
with GNU General Public License v3.0
from aelariane

private void Start()
    {
        this.rope = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("rope"));
        this.lineRenderer = this.rope.GetComponent<LineRenderer>();
        FengGameManagerMKII.FGM.AddHook(this);
    }

19 Source : CharacterMaterials.cs
with GNU General Public License v3.0
from aelariane

public static void Init()   
    {
        if (initialized)
        {
            return;
        }
        initialized = true;
        Materials = new Dictionary<string, Material>();
        NewMaterial("AOTTG_HERO_3DMG");
        NewMaterial("aottg_hero_AHSS_3dmg");
        NewMaterial("aottg_hero_annie_cap_causal");
        NewMaterial("aottg_hero_annie_cap_uniform");
        NewMaterial("aottg_hero_brand_sc");
        NewMaterial("aottg_hero_brand_mp");
        NewMaterial("aottg_hero_brand_g");
        NewMaterial("aottg_hero_brand_ts");
        NewMaterial("aottg_hero_skin_1");
        NewMaterial("aottg_hero_skin_2");
        NewMaterial("aottg_hero_skin_3");
        NewMaterial("aottg_hero_casual_fa_1");
        NewMaterial("aottg_hero_casual_fa_2");
        NewMaterial("aottg_hero_casual_fa_3");
        NewMaterial("aottg_hero_casual_fb_1");
        NewMaterial("aottg_hero_casual_fb_2");
        NewMaterial("aottg_hero_casual_ma_1");
        NewMaterial("aottg_hero_casual_ma_1_ahss");
        NewMaterial("aottg_hero_casual_ma_2");
        NewMaterial("aottg_hero_casual_ma_3");
        NewMaterial("aottg_hero_casual_mb_1");
        NewMaterial("aottg_hero_casual_mb_2");
        NewMaterial("aottg_hero_casual_mb_3");
        NewMaterial("aottg_hero_casual_mb_4");
        NewMaterial("aottg_hero_uniform_fa_1");
        NewMaterial("aottg_hero_uniform_fa_2");
        NewMaterial("aottg_hero_uniform_fa_3");
        NewMaterial("aottg_hero_uniform_fb_1");
        NewMaterial("aottg_hero_uniform_fb_2");
        NewMaterial("aottg_hero_uniform_ma_1");
        NewMaterial("aottg_hero_uniform_ma_2");
        NewMaterial("aottg_hero_uniform_ma_3");
        NewMaterial("aottg_hero_uniform_mb_1");
        NewMaterial("aottg_hero_uniform_mb_2");
        NewMaterial("aottg_hero_uniform_mb_3");
        NewMaterial("aottg_hero_uniform_mb_4");
        NewMaterial("hair_annie");
        NewMaterial("hair_armin");
        NewMaterial("hair_boy1");
        NewMaterial("hair_boy2");
        NewMaterial("hair_boy3");
        NewMaterial("hair_boy4");
        NewMaterial("hair_eren");
        NewMaterial("hair_girl1");
        NewMaterial("hair_girl2");
        NewMaterial("hair_girl3");
        NewMaterial("hair_girl4");
        NewMaterial("hair_girl5");
        NewMaterial("hair_hanji");
        NewMaterial("hair_jean");
        NewMaterial("hair_levi");
        NewMaterial("hair_marco");
        NewMaterial("hair_mike");
        NewMaterial("hair_petra");
        NewMaterial("hair_rico");
        NewMaterial("hair_sasha");
        NewMaterial("hair_mikasa");
        Texture mainTexture = (Texture)Object.Instantiate(Resources.Load("NewTexture/aottg_hero_eyes"));
        Material material = (Material)Object.Instantiate(Resources.Load("NewTexture/MaterialGLreplaced"));
        material.mainTexture = mainTexture;
        Materials.Add("aottg_hero_eyes", material);
    }

19 Source : TITAN_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void setPunkHair()
    {
        UnityEngine.Object.Destroy(this.part_hair);
        this.hair = CostumeHair.hairsM[3];
        this.hairType = 3;
        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
        gameObject.transform.parent = this.hair_go_ref.transform.parent;
        gameObject.transform.position = this.hair_go_ref.transform.position;
        gameObject.transform.rotation = this.hair_go_ref.transform.rotation;
        gameObject.transform.localScale = this.hair_go_ref.transform.localScale;
        gameObject.renderer.material = CharacterMaterials.Materials[this.hair.texture];
        int num = UnityEngine.Random.Range(1, 4);
        if (num == 1)
        {
            gameObject.renderer.material.color = FengColor.hairPunk1;
        }
        if (num == 2)
        {
            gameObject.renderer.material.color = FengColor.hairPunk2;
        }
        if (num == 3)
        {
            gameObject.renderer.material.color = FengColor.hairPunk3;
        }
        this.part_hair = gameObject;
        this.setFacialTexture(this.eye, 0);
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && BasePV.IsMine)
        {
            BasePV.RPC("setHairPRC", PhotonTargets.OthersBuffered, new object[]
            {
                this.hairType,
                0,
                this.part_hair.renderer.material.color.r,
                this.part_hair.renderer.material.color.g,
                this.part_hair.renderer.material.color.b
            });
        }
    }

19 Source : IN_GAME_MAIN_CAMERA.cs
with GNU General Public License v3.0
from aelariane

public void setDayLight(DayLight val)
    {
        DayLight = val;
        if (DayLight == DayLight.Night)
        {
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("flashlight"));
            gameObject.transform.parent = BaseT;
            gameObject.transform.position = BaseT.position;
            gameObject.transform.rotation = Quaternion.Euler(353f, 0f, 0f);
            RenderSettings.ambientLight = FengColor.nightAmbientLight;
            CacheGameObject.Find("mainLight").GetComponent<Light>().color = FengColor.nightLight;
            BaseG.GetComponent<Skybox>().material = this.skyBoxNIGHT;
        }
        if (DayLight == DayLight.Day)
        {
            RenderSettings.ambientLight = FengColor.dayAmbientLight;
            CacheGameObject.Find("mainLight").GetComponent<Light>().color = FengColor.dayLight;
            BaseG.GetComponent<Skybox>().material = this.skyBoxDAY;
        }
        if (DayLight == DayLight.Dawn)
        {
            RenderSettings.ambientLight = FengColor.dawnAmbientLight;
            CacheGameObject.Find("mainLight").GetComponent<Light>().color = FengColor.dawnAmbientLight;
            BaseG.GetComponent<Skybox>().material = this.skyBoxDAWN;
        }
        this.snapShotCamera.gameObject.GetComponent<Skybox>().material = BaseG.GetComponent<Skybox>().material;
    }

19 Source : FlareMovement.cs
with GNU General Public License v3.0
from aelariane

private void Start()
    {
        this.hero = IN_GAME_MAIN_CAMERA.MainObject;
        if (!this.nohint && this.hero != null)
        {
            this.hint = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("UI/" + this.color + "FlareHint"));
            if (this.color == "Black")
            {
                this.offY = Vectors.up * 0.4f;
            }
            else
            {
                this.offY = Vectors.up * 0.5f;
            }
            this.hint.transform.parent = base.transform.root;
            this.hint.transform.position = this.hero.transform.position + this.offY;
            Vector3 vector = base.transform.position - this.hint.transform.position;
            float num = Mathf.Atan2(-vector.z, vector.x) * 57.29578f;
            this.hint.transform.rotation = Quaternion.Euler(-90f, num + 180f, 0f);
            this.hint.transform.localScale = Vectors.zero;
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                1f,
                "y",
                1f,
                "z",
                1f,
                "easetype",
                iTween.EaseType.easeOutElastic,
                "time",
                1f
            }));
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                0,
                "y",
                0,
                "z",
                0,
                "easetype",
                iTween.EaseType.easeInBounce,
                "time",
                0.5f,
                "delay",
                2.5f
            }));
        }
    }

19 Source : FlareMovement.cs
with GNU General Public License v3.0
from aelariane

private void OnEnable()
    {
        this.hero = IN_GAME_MAIN_CAMERA.MainObject;
        if (!this.nohint && this.hero != null)
        {
            if (hint == null)
            {
                this.hint = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("UI/" + this.color + "FlareHint"));
            }

            if (this.color == "Black")
            {
                this.offY = Vectors.up * 0.4f;
            }
            else
            {
                this.offY = Vectors.up * 0.5f;
            }
            this.hint.transform.parent = base.transform.root;
            this.hint.transform.position = this.hero.transform.position + this.offY;
            Vector3 vector = base.transform.position - this.hint.transform.position;
            float num = Mathf.Atan2(-vector.z, vector.x) * 57.29578f;
            this.hint.transform.rotation = Quaternion.Euler(-90f, num + 180f, 0f);
            this.hint.transform.localScale = Vectors.zero;
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                1f,
                "y",
                1f,
                "z",
                1f,
                "easetype",
                iTween.EaseType.easeOutElastic,
                "time",
                1f
            }));
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                0,
                "y",
                0,
                "z",
                0,
                "easetype",
                iTween.EaseType.easeInBounce,
                "time",
                0.5f,
                "delay",
                2.5f
            }));
        }
        timer = 0f;
    }

19 Source : TITAN_SETUP.cs
with GNU General Public License v3.0
from aelariane

private void setHairVanilla()
    {
        UnityEngine.Object.Destroy(this.part_hair);
        int num = UnityEngine.Random.Range(0, CostumeHair.hairsM.Length);
        if (num == 3)
        {
            num = 9;
        }
        this.hairType = num;
        this.hair = CostumeHair.hairsM[num];
        if (this.hair.hair == string.Empty)
        {
            this.hair = CostumeHair.hairsM[9];
            this.hairType = 9;
        }
        this.part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
        this.part_hair.transform.parent = this.hair_go_ref.transform.parent;
        this.part_hair.transform.position = this.hair_go_ref.transform.position;
        this.part_hair.transform.rotation = this.hair_go_ref.transform.rotation;
        this.part_hair.transform.localScale = this.hair_go_ref.transform.localScale;
        this.part_hair.renderer.material = CharacterMaterials.Materials[this.hair.texture];
        this.part_hair.renderer.material.color = HeroCostume.costume[UnityEngine.Random.Range(0, HeroCostume.costume.Length - 5)].hair_color;
        int num2 = UnityEngine.Random.Range(1, 8);
        this.setFacialTexture(this.eye, num2);
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && BasePV.IsMine)
        {
            BasePV.RPC("setHairPRC", PhotonTargets.OthersBuffered, new object[]
            {
                this.hairType,
                num2,
                this.part_hair.renderer.material.color.r,
                this.part_hair.renderer.material.color.g,
                this.part_hair.renderer.material.color.b
            });
        }
    }

19 Source : UIMainReferences.cs
with GNU General Public License v3.0
from aelariane

private void Start()
    {
        GameObject.Find("VERSION").GetComponent<UILabel>().text = "Loading...";
        NGUITools.SetActive(this.panelMain, false);
        if (isGAMEFirstLaunch)
        {
            isGAMEFirstLaunch = false;
            GameObject input = (GameObject)Resources.Load("InputManagerController");
            input.GetComponent<FengCustomInputs>().enabled = false;
            input.AddComponent<Anarchy.InputManager>();
            var inputs = (GameObject)Instantiate(input);
            inputs.name = "InputManagerController";
            DontDestroyOnLoad(inputs);
            new GameObject("AnarchyManager").AddComponent<Anarchy.AnarchyManager>();
        }
        Anarchy.Network.NetworkManager.TryRejoin();
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateHead()
    {
        UnityEngine.Object.Destroy(this.part_eye);
        UnityEngine.Object.Destroy(this.part_face);
        UnityEngine.Object.Destroy(this.part_glreplaced);
        UnityEngine.Object.Destroy(this.part_hair);
        if (!this.IsDeadBody)
        {
            ClothFactory.DisposeObject(this.part_hair_1);
        }
        this.CreateHair();
        if (this.myCostume.eye_mesh.Length > 0)
        {
            this.part_eye = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.eye_mesh));
            this.part_eye.transform.position = this.part_head.transform.position;
            this.part_eye.transform.rotation = this.part_head.transform.rotation;
            this.part_eye.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
            this.SetFacialTexture(this.part_eye, this.myCostume.eye_texture_id);
        }
        if (this.myCostume.beard_texture_id >= 0)
        {
            this.CreateFace();
            this.SetFacialTexture(this.part_face, this.myCostume.beard_texture_id);
        }
        if (this.myCostume.glreplaced_texture_id >= 0)
        {
            this.CreateGlreplaced();
            this.SetFacialTexture(this.part_glreplaced, this.myCostume.glreplaced_texture_id);
        }
        string indexHead = myCostume.skin_texture;
        string indexChest = myCostume.skin_texture;
        if (!CharacterMaterials.Materials.ContainsKey(indexHead))
        {
            indexHead = "hair_annie";
        }
        if (!CharacterMaterials.Materials.ContainsKey(indexChest))
        {
            indexChest = "aottg_hero_skin_1";
        }
        this.part_head.renderer.material = CharacterMaterials.Materials[indexHead];
        this.part_chest.renderer.material = CharacterMaterials.Materials[indexChest];
    }

19 Source : HERO_SETUP.cs
with GNU General Public License v3.0
from aelariane

public void CreateHead()
    {
        UnityEngine.Object.Destroy(this.part_eye);
        UnityEngine.Object.Destroy(this.part_face);
        UnityEngine.Object.Destroy(this.part_glreplaced);
        UnityEngine.Object.Destroy(this.part_hair);
        if (!this.IsDeadBody)
        {
            ClothFactory.DisposeObject(this.part_hair_1);
        }
        this.CreateHair();
        if (this.myCostume.eye_mesh.Length > 0)
        {
            this.part_eye = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.eye_mesh));
            this.part_eye.transform.position = this.part_head.transform.position;
            this.part_eye.transform.rotation = this.part_head.transform.rotation;
            this.part_eye.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
            this.SetFacialTexture(this.part_eye, this.myCostume.eye_texture_id);
        }
        if (this.myCostume.beard_texture_id >= 0)
        {
            this.CreateFace();
            this.SetFacialTexture(this.part_face, this.myCostume.beard_texture_id);
        }
        if (this.myCostume.glreplaced_texture_id >= 0)
        {
            this.CreateGlreplaced();
            this.SetFacialTexture(this.part_glreplaced, this.myCostume.glreplaced_texture_id);
        }
        string indexHead = myCostume.skin_texture;
        string indexChest = myCostume.skin_texture;
        if(!CharacterMaterials.Materials.ContainsKey(indexHead))
        {
            indexHead = "hair_annie";
        }
        if (!CharacterMaterials.Materials.ContainsKey(indexChest))
        {
            indexChest = "aottg_hero_skin_1";
        }
        this.part_head.renderer.material = CharacterMaterials.Materials[indexHead];
        this.part_chest.renderer.material = CharacterMaterials.Materials[indexChest];
    }

19 Source : MapCeiling.cs
with GNU General Public License v3.0
from aelariane

private void Start()
        {
            GameObject bombCeiling = (GameObject)UnityEngine.Object.Instantiate(Optimization.Caching.CacheResources.RCLoad("barrier"), new Vector3(0f, 280f, 0f), Quaternion.idenreplacedy);
            bombCeiling.transform.position = this.transform.position;
            bombCeiling.transform.rotation = this.transform.rotation;
            bombCeiling.transform.localScale = this.transform.localScale;

            _barrierRef = (GameObject)UnityEngine.Object.Instantiate(Optimization.Caching.CacheResources.RCLoad("killcuboid"), new Vector3(0f, 280f, 0f), Quaternion.idenreplacedy); //name of object and xyz position, its 280 height
            _barrierRef.transform.position = this.transform.position;
            _barrierRef.transform.rotation = this.transform.rotation;
            _barrierRef.transform.localScale = this.transform.localScale;
            _color = new Color(1, 0, 0, _maxAlpha);

            // check if we want to enable barrier fade.
            if (UseFade)
            {
                UpdateTransparency();
            }
            else
            {
                // disable monobehavior "behaviors" (update will not be called).
                enabled = false;
            }
        }

19 Source : NGUITools.cs
with GNU General Public License v3.0
from aelariane

public static GameObject AddChild(GameObject parent, GameObject prefab)
    {
        GameObject gameObject = UnityEngine.Object.Instantiate(prefab) as GameObject;
        if (gameObject != null && parent != null)
        {
            Transform transform = gameObject.transform;
            transform.parent = parent.transform;
            transform.localPosition = Vectors.zero;
            transform.localRotation = Quaternion.idenreplacedy;
            transform.localScale = Vectors.one;
            gameObject.layer = parent.layer;
        }
        return gameObject;
    }

19 Source : ManualPhotonViewAllocator.cs
with GNU General Public License v3.0
from aelariane

[RPC]
    public void InstantiateRpc(int viewID)
    {
        GameObject gameObject = UnityEngine.Object.Instantiate(this.Prefab, InputToEvent.inputHitPos + new Vector3(0f, 5f, 0f), Quaternion.idenreplacedy) as GameObject;
        gameObject.GetPhotonView().viewID = viewID;
        OnClickDestroy component = gameObject.GetComponent<OnClickDestroy>();
        component.DestroyByRpc = true;
    }

19 Source : StyledComboBox.cs
with GNU General Public License v3.0
from aelariane

private void AddItem(object data)
    {
        if (this.itemPrefab != null)
        {
            Vector3[] array = new Vector3[4];
            this.itemPrefab.GetComponent<RectTransform>().GetLocalCorners(array);
            Vector3 position = array[0];
            float num = position.y - array[2].y;
            position.y = (float)this.items.Count * num;
            StyledItem styledItem = UnityEngine.Object.Instantiate(this.itemPrefab, position, this.root.itemRoot.rotation) as StyledItem;
            RectTransform component = styledItem.GetComponent<RectTransform>();
            styledItem.Populate(data);
            component.SetParent(this.root.itemRoot.transform, false);
            component.pivot = new Vector2(0f, 1f);
            component.anchorMin = new Vector2(0f, 1f);
            component.anchorMax = Vectors.v2one;
            component.ancreplaceddPosition = new Vector2(0f, position.y);
            this.items.Add(styledItem);
            component.offsetMin = new Vector2(0f, position.y + num);
            component.offsetMax = new Vector2(0f, position.y);
            this.root.itemRoot.offsetMin = new Vector2(this.root.itemRoot.offsetMin.x, (float)(this.items.Count + 2) * num);
            Button button = styledItem.GetButton();
            int curIndex = this.items.Count - 1;
            if (button != null)
            {
                button.onClick.AddListener(delegate
                {
                    this.OnItemClicked(styledItem, curIndex);
                });
            }
        }
    }

19 Source : StyledComboBox.cs
with GNU General Public License v3.0
from aelariane

private void CreateMenuButton(object data)
    {
        if (this.root.menuItem.transform.childCount > 0)
        {
            for (int i = this.root.menuItem.transform.childCount - 1; i >= 0; i--)
            {
                UnityEngine.Object.DestroyObject(this.root.menuItem.transform.GetChild(i).gameObject);
            }
        }
        if (this.itemMenuPrefab != null && this.root.menuItem != null)
        {
            StyledItem styledItem = UnityEngine.Object.Instantiate(this.itemMenuPrefab) as StyledItem;
            styledItem.Populate(data);
            styledItem.transform.SetParent(this.root.menuItem.transform, false);
            RectTransform component = styledItem.GetComponent<RectTransform>();
            component.pivot = new Vector2(0.5f, 0.5f);
            component.anchorMin = Vectors.v2zero;
            component.anchorMax = Vectors.v2one;
            component.offsetMin = Vectors.v2zero;
            component.offsetMax = Vectors.v2zero;
            this.root.gameObject.hideFlags = HideFlags.HideInHierarchy;
            Button button = styledItem.GetButton();
            if (button != null)
            {
                button.onClick.AddListener(new UnityAction(this.TogglePanelState));
            }
        }
    }

19 Source : StyledComboBox.cs
with GNU General Public License v3.0
from aelariane

public void InitControl()
    {
        if (this.root != null)
        {
            UnityEngine.Object.DestroyImmediate(this.root.gameObject);
        }
        if (this.containerPrefab != null)
        {
            RectTransform component = base.GetComponent<RectTransform>();
            this.root = (UnityEngine.Object.Instantiate(this.containerPrefab, component.position, component.rotation) as StyledComboBoxPrefab);
            this.root.transform.SetParent(base.transform, false);
            RectTransform component2 = this.root.GetComponent<RectTransform>();
            component2.pivot = new Vector2(0.5f, 0.5f);
            component2.anchorMin = Vectors.v2zero;
            component2.anchorMax = Vectors.v2one;
            component2.offsetMax = Vectors.v2zero;
            component2.offsetMin = Vectors.v2zero;
            this.root.gameObject.hideFlags = HideFlags.HideInHierarchy;
            this.root.itemPanel.gameObject.SetActive(this.isToggled);
        }
    }

19 Source : Pool.cs
with GNU General Public License v3.0
from aelariane

public static GameObject Enable(string name, Vector3 position, Quaternion rotation)
        {
            var result = (GameObject)Object.Instantiate(CacheResources.Load(name), position, rotation);
            //if(result.rigidbody != null)
            //{
                //result.rigidbody.interpolation = RigidbodyInterpolation.Interpolate;
            //}
            return result;
        }

19 Source : PoolObject.cs
with GNU General Public License v3.0
from aelariane

private GameObject CreateObject(string name)
        {
            Object resource = name.StartsWith("RCreplacedet/") ? CacheResources.RCLoad(name) : CacheResources.Load(name);
            if (resource == null)
            {
                throw new System.Exception($"PoolObject.CreateObject(): Cannot find Resource with name \"{name}\". Please check Keys for values.");
            }
            GameObject res = (GameObject)Object.Instantiate(resource);
            res.AddComponent<PoolableObject>();
            //Object.DontDestroyOnLoad(res);
            res.SetActive(false);
            return res;
        }

19 Source : XffectCache.cs
with GNU General Public License v3.0
from aelariane

protected Transform AddObject(string name)
    {
        Transform transform = base.transform.Find(name);
        if (transform == null)
        {
            Debug.Log("object:" + name + "doesn't exist!");
            return null;
        }
        Transform transform2 = UnityEngine.Object.Instantiate(transform, Vectors.zero, Quaternion.idenreplacedy) as Transform;
        this.ObjectDic[name].Add(transform2);
        transform2.gameObject.SetActive(false);
        Xffect component = transform2.GetComponent<Xffect>();
        if (component != null)
        {
            component.Initialize();
        }
        return transform2;
    }

19 Source : NucleonSpawner.cs
with MIT License
from alchemz

void SpawnNucleon()
    {
        Nucleon prefab = nucleonPrefabs[Random.Range(0, nucleonPrefabs.Length)];
        Nucleon spawn = Instantiate<Nucleon>(prefab);
        spawn.transform.localPosition = Random.onUnitSphere * spawnDistance;
    }

19 Source : LocalPlayerController.cs
with GNU General Public License v3.0
from ARPOISE

public void SpawnAnchor(Vector3 position, Quaternion rotation, Component anchor)
        {
            // Instantiate Anchor model at the hit pose.
            var anchorObject = Instantiate(AnchorPrefab, position, rotation);

            // Anchor must be hosted in the device.
            anchorObject.GetComponent<AnchorController>().HostLastPlacedAnchor(anchor);

            // Host can spawn directly without using a Command because the server is running in this instance.
#pragma warning disable 618
            NetworkServer.Spawn(anchorObject);
#pragma warning restore 618
        }

19 Source : LocalPlayerController.cs
with GNU General Public License v3.0
from ARPOISE

[Command]
#pragma warning restore 618
        public void CmdSpawnStar(Vector3 position, Quaternion rotation)
        {
            // Instantiate Star model at the hit pose.
            var starObject = Instantiate(StarPrefab, position, rotation);

            // Spawn the object in all clients.
#pragma warning disable 618
            NetworkServer.Spawn(starObject);
#pragma warning restore 618
        }

19 Source : WorkingAreaBase.cs
with MIT License
from arran-nz

protected void AddWorkers(int amount)
    {
        if(amount >= 1)
        {
            Workers.Value += amount;

            for (int i = 0; i < amount; i++)
            {
                Vector2 randomOffset = new Vector3(
                    UnityEngine.Random.Range(-WorkerSpawnRangeX, WorkerSpawnRangeX),
                    0);

                Instantiate(
                    workerPrefab,
                    DepositPosition + randomOffset,
                    new Quaternion(0,0,0,0),
                    this.transform);
            }
        }
    }

19 Source : MineManager.cs
with MIT License
from arran-nz

public void AddNewMine()
    {
        GameController.Instance.SpendCash(newMineCost,
            () =>
            {
                Vector3 spawnPos = new Vector3(
                Mines[0].transform.position.x,
                Mines[MineCount - 1].transform.position.y - MINE_SPACING
                );

                GameObject clone = Instantiate(
                    minePrefab,
                    spawnPos,
                    new Quaternion(0, 0, 0, 0),
                    this.transform);

                Mine newMine = clone.GetComponent<Mine>();
                Mines.Add(newMine);
                newMine.SetMineIndex(MineCount);

                newMineCost = (decimal)Mathf.Pow(UPGRADE_COST_POWER, MineCount + 2);

                UpdateNewMineButton(clone.transform.position);
            }
            );           

    }

19 Source : UpgradePanel.cs
with MIT License
from arran-nz

private void PopulatePanel()
    {
        // Set Header and Upgrade Cost
        headerDisplay.text = workingArea.WorkingAreaName + " Level " + workingArea.AreaLevel;
        upgradeCostDisplay.text = StringFormatter.GetCurrencyString(workingArea.CurrentUpgradeCost);

        // Clear and destroy any existing attribute displays if present
        if (areaAttributeDisplays.Count > 0)
        {
            foreach (var item in areaAttributeDisplays)
            {
                Destroy(item.gameObject);
            }

            areaAttributeDisplays.Clear();
        }


        int visibleAttributeCount = 0;

        // If working area has the ability to add workers, display this
        if (workingArea.CanAddWorkers)
        {
            GameObject clone = Instantiate(areaStatPrefab, areaStatsSpawnParent);

            Vector3 spawnPos = GetAttributeSpawnPos(visibleAttributeCount, clone.transform);

            AreaAttributeDisplay currentAreaStat = clone.GetComponent<AreaAttributeDisplay>();
            currentAreaStat.UpdateAttributeDisplay(
                workingArea.Workers.DisplayName,
                workingArea.Workers.GetDisplayString(),
                workingArea.Workers.StringFormatMethod(workingArea.Workers.GetUpgradeAmount()),
                spawnPos
                );

            areaAttributeDisplays.Add(currentAreaStat);

            visibleAttributeCount = 1;
        }


        // Populate the <decimal> attribute displays with new data

        foreach (AreaAttribute<decimal> currentAttribute in workingArea.AreaAttributes)
        {
            GameObject clone = Instantiate(areaStatPrefab, areaStatsSpawnParent);

            Vector3 spawnPos = GetAttributeSpawnPos(visibleAttributeCount, clone.transform);

            AreaAttributeDisplay currentAreaStat = clone.GetComponent<AreaAttributeDisplay>();
            currentAreaStat.UpdateAttributeDisplay(
                currentAttribute.DisplayName,
                currentAttribute.GetDisplayString(),
                currentAttribute.StringFormatMethod(currentAttribute.GetUpgradeAmount()),
                spawnPos
                );

            areaAttributeDisplays.Add(currentAreaStat);

            visibleAttributeCount++;
        }
       
    }

19 Source : LocalPlayerController.cs
with MIT License
from ashishgopalhattimare

public void SpawnAnchor(Vector3 position, Quaternion rotation, Component anchor)
        {
            // Instantiate Anchor model at the hit pose.
            var anchorObject = Instantiate(AnchorPrefab, position, rotation);

            // Anchor must be hosted in the device.
            anchorObject.GetComponent<AnchorController>().HostLastPlacedAnchor(anchor);

            // Host can spawn directly without using a Command because the server is running in this instance.
            NetworkServer.Spawn(anchorObject);
        }

19 Source : LocalPlayerController.cs
with MIT License
from ashishgopalhattimare

[Command]
        public void CmdSpawnStar(Vector3 position, Quaternion rotation)
        {
            // Instantiate Star model at the hit pose.
            var starObject = Instantiate(StarPrefab, position, rotation);

            // Spawn the object in all clients.
            NetworkServer.Spawn(starObject);
        }

19 Source : CustomCreateObject.cs
with GNU General Public License v3.0
from Athlon007

public override void OnEnter()
        {
            newObject = GameObject.Instantiate(prefab);
            newObject.transform.position = parent.transform.position;
            newObject.name = newObject.name.Replace("(Clone)(Clone)", "(Clone)");
            newObject.SetActive(true);
            newObject.AddComponent<ItemBehaviour>();
        }

19 Source : ItemsManager.cs
with GNU General Public License v3.0
from Athlon007

internal void Initialize()
        {
            cashRegisterHook = GameObject.Find("STORE/StoreCashRegister/Register").AddComponent<CashRegisterBehaviour>();

            Transform spawner = GameObject.Find("Spawner").transform;

            InjectSpawnScripts(spawner.Find("CreateItems").gameObject);
            InjectSpawnScripts(spawner.Find("CreateSpraycans").gameObject);
            InjectSpawnScripts(spawner.Find("CreateShoppingbag").gameObject);
            InjectSpawnScripts(spawner.Find("CreateMooseMeat").gameObject);
            InjectSpawnScripts(GameObject.Find("fish trap(itemx)").transform.Find("Spawn").gameObject);

            GetCanTrigger();

            // Car parts order bill hook.
            try
            {
                GameObject storeLOD = GameObject.Find("STORE").transform.Find("LOD").gameObject;
                GameObject activateStore = storeLOD.transform.Find("ActivateStore").gameObject;
                bool lodLastState = storeLOD.activeSelf;
                bool activeStore = activateStore.activeSelf;

                if (!lodLastState)
                    storeLOD.SetActive(true);

                if (!activeStore)
                    activateStore.SetActive(true);

                GameObject postOrder = GameObject.Find("STORE").transform.Find("LOD/ActivateStore/PostOffice/PostOrderBuy").gameObject;
                bool isPostOrderActive = postOrder.activeSelf;
                postOrder.SetActive(true);
                FsmHook.FsmInject(postOrder, "State 3", cashRegisterHook.Packages);
                if (!isPostOrderActive)
                    postOrder.SetActive(false);

                storeLOD.SetActive(lodLastState);
                activateStore.SetActive(activateStore);
            }
            catch
            {
                throw new System.Exception("Couldn't inject PostOrderBuy object.");
            }

            InitializeList();

            // Hooks all bottles and adds adds BeerBottle script to them, which deletes the object and adds the ItemHook to them.
            Dictionary<string, string> names = new Dictionary<string, string>()
            {
                {
                    "BottleBeerFly",
                    "empty bottle(Clone)"
                },
                {
                    "BottleBoozeFly",
                    "empty bottle(Clone)"
                },
                {
                    "BottleSpiritFly",
                    "empty bottle(Clone)"
                },
                {
                    "CoffeeFly",
                    "empty cup(Clone)"
                },
                {
                    "MilkFly",
                    "empty pack(Clone)"
                },
                {
                    "VodkaShotFly",
                    "empty glreplaced(Clone)"
                }
            };
            foreach (GameObject gameObject in Resources.FindObjectsOfTypeAll<GameObject>().Where(obj => names.ContainsKey(obj.name) && obj.GetComponent<PlayMakerFSM>() != null))
            {
                gameObject.AddComponent<ThrowableJunkBehaviour>();
            }

            // Hook the prefab of firewood.
            GameObject firewoodPrefab = Resources.FindObjectsOfTypeAll<GameObject>().FirstOrDefault(f => f.name.EqualsAny("firewood") && f.GetComponent<PlayMakerFSM>() == null).gameObject;
            if (firewoodPrefab)
            {
                firewoodPrefab.AddComponent<ItemBehaviour>();
            }

            // Hook the prefab of log.
            GameObject logPrefab = Resources.FindObjectsOfTypeAll<GameObject>().FirstOrDefault(f => f.name.EqualsAny("log") && f.GetComponent<PlayMakerFSM>() == null).gameObject;
            if (logPrefab)
            {
                logPrefab.AddComponent<ItemBehaviour>();
                logPrefab.transform.Find("log(Clone)").gameObject.AddComponent<ItemBehaviour>();
            }

            foreach (var f in Resources.FindObjectsOfTypeAll<GameObject>().Where(g => g.name == "log(Clone)"))
            {
                f.AddComponent<ItemBehaviour>();
            }

            radiatorHose3Database = GameObject.Find("Database/DatabaseMechanics/RadiatorHose3").GetPlayMakerFSM("Data");
            GameObject attachedHose = Resources.FindObjectsOfTypeAll<GameObject>().First(g => g.name == "radiator hose3(xxxxx)");
            realRadiatorHose = Resources.FindObjectsOfTypeAll<GameObject>().First(g => g.name == "radiator hose3(Clone)");
            GameObject dummy = GameObject.Instantiate(realRadiatorHose); // used for spawning the radiator hose3 after it gets detached.

            UnityEngine.Object.Destroy(dummy.GetComponent<ItemBehaviour>());
            dummy.SetActive(false);
            dummy.name = dummy.name.Replace("(Clone)(Clone)", "(Clone)");

            Transform t = SaveManager.GetRadiatorHose3Transform();

            if (!attachedHose.activeSelf)
            {
                realRadiatorHose.transform.position = t.position;
                realRadiatorHose.transform.rotation = t.rotation;
                realRadiatorHose.SetActive(true);
            }
            radiatorHose3Database.FsmVariables.GameObjectVariables.First(g => g.Name == "SpawnThis").Value = realRadiatorHose;
        }

19 Source : Loader.cs
with GNU General Public License v3.0
from Athlon007

public void Initialize(bool overrideUpdateCheck)
        {
            lastModListPath = $"{MOP.ModConfigPath}/LastModList.mop";
            lastDateFilePath = $"{MOP.ModConfigPath}/LastUpdate.mop";
            this.overrideUpdateCheck = overrideUpdateCheck;

            if (GameObject.Find("MOP_Messager") != null)
            {
                message = GameObject.Find("MOP_Messager").GetComponent<TextMesh>();
                shadow = message.gameObject.transform.GetChild(0).gameObject.GetComponent<TextMesh>();
            }
            else
            {
                float div = (float)Screen.width / (float)Screen.height;
                float x = div  < 1.3f ? 4f : div < 1.6f ? 4.5f : 6f;

                GameObject text = GameObject.Instantiate(GameObject.Find("Interface/Songs/Text"));
                text.transform.localPosition = new Vector3(x, 2.6f, 0.01f);
                text.name = "MOP_Messager";
                message = text.GetComponent<TextMesh>();
                message.alignment = TextAlignment.Right;
                message.anchor = TextAnchor.UpperRight;
                shadow = text.transform.GetChild(0).gameObject.GetComponent<TextMesh>();
                shadow.alignment = TextAlignment.Right;
                shadow.anchor = TextAnchor.UpperRight;
                NewMessage("");
            }

            if (!MOP.RulesAutoUpdate.Value && !overrideUpdateCheck)
            {
                ModConsole.Log("<color=orange>[MOP] Rule files auto update is disabled.</color>");
                GetAndReadRules();
                return;
            }

            // Don't check if the server is online, if the update check has been done already.
            if (RulesManager.Instance.UpdateChecked)
            {
                GetAndReadRules();
                return;
            }

            // If server or user is offline, skip downloading and simply load available files.
            if (!IsServerOnline())
            {
                ModConsole.Log("<color=red>[MOP] Connection error. Check your Internet connection.</color>");
                GetAndReadRules();
                return;
            }

            StartCoroutine(DownloadAndUpdateRoutine());
        }

19 Source : GameObjectFactory.cs
with Apache License 2.0
from bnoazx005

public IEnreplacedy Spawn(GameObject prefab, Vector3 position, Quaternion rotation, Transform parent)
        {
            GameObject gameObjectInstance = GameObject.Instantiate(prefab, position, rotation, parent);

            IView viewComponent = gameObjectInstance.GetComponent<IView>() ?? throw new NullReferenceException();

            EnreplacedyId linkedEnreplacedyId = mWorldContext.CreateEnreplacedy(/*gameObjectInstance.name*/);

            IEnreplacedy linkedEnreplacedy = mWorldContext.GetEnreplacedyById(linkedEnreplacedyId);

            viewComponent.WorldContext = mWorldContext;

            linkedEnreplacedy.AddComponent(new TViewComponent { mView = viewComponent as BaseView });

            viewComponent.Link(linkedEnreplacedyId);
            
            return linkedEnreplacedy;
        }

19 Source : SpawnSystem.cs
with Apache License 2.0
from bnoazx005

public override void Update(List<IEnreplacedy> enreplacedies, float deltaTime)
    {
        for (int i = 0; i < enreplacedies.Count; ++i)
        {
            GameObject.Instantiate(mPrefab, enreplacedies[i].GetComponent<TClickedComponent>().mWorldPosition,
                                   Quaternion.idenreplacedy, null);
        }
    }

19 Source : GraphAsset.cs
with MIT License
from BrunoS3D

public Graphreplacedet GetClone() {
			Graphreplacedet instance = Instantiate(this);
			instance.isInstance = true;
			return instance;
		}

19 Source : TextureUtil.cs
with MIT License
from CitiesSkylinesMods

private static UITextureAtlas PackTextures(string atlasName,
                                                   IntVector2 atlreplacedizeHint,
                                                   List<Texture2D> loadedTextures,
                                                   List<string> loadedSpriteNames) {
            Texture2D texture2D = new Texture2D(
                width: atlreplacedizeHint.x,
                height: atlreplacedizeHint.y,
                format: TextureFormat.ARGB32,
                mipmap: false);

            Rect[] regions = texture2D.PackTextures(
                textures: loadedTextures.ToArray(),
                padding: 2,
                maximumAtlreplacedize: Math.Max(atlreplacedizeHint.x, atlreplacedizeHint.y));

            // Now using loaded and packed textures, create the atlas with sprites
            UITextureAtlas newAtlas = ScriptableObject.CreateInstance<UITextureAtlas>();
            var uiView = UIView.GetAView();
            Material material = UnityEngine.Object.Instantiate(uiView.defaultAtlas.material);

            material.mainTexture = texture2D;
            newAtlas.material = material;
            newAtlas.name = atlasName;

            for (int i = 0; i < loadedTextures.Count; i++) {
                var item = new UITextureAtlas.SpriteInfo {
                    name = loadedSpriteNames[i],
                    texture = loadedTextures[i],
                    region = regions[i],
                };
                newAtlas.AddSprite(item);
            }

            return newAtlas;
        }

19 Source : ParticlePainter.cs
with MIT License
from codeyuan666

void Start () {
        UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
        currentPS = Instantiate (painterParticlePrefab);
        currentPaintVertices = new List<Vector3> ();
        paintSystems = new List<ParticleSystem> ();
        frameUpdated = false;
        colorPicker.onValueChanged.AddListener( newColor => currentColor = newColor);
        colorPicker.gameObject.SetActive (false);
	}

19 Source : PointCloudParticleExample.cs
with MIT License
from codeyuan666

void Start () {
        UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
        currentPS = Instantiate (pointCloudParticlePrefab);
        frameUpdated = false;
	}

See More Examples