public override void Start() { base.Start(); spin = Random.onUnitSphere * spinSpeed; Quaternion launcherRotation = Quaternion.FromToRotation(Vector3.up, worldVelocity.normalized); GameObject temp = (GameObject)GameObject.Instantiate(launcherPrefab, transform.position, launcherRotation); temp.transform.Find("Quad").GetComponent <Renderer>().material.SetColor("_TintColor", weaponInst.GetLowAlphaColor()); foreach (ParticleSystem p in temp.GetComponentsInChildren <ParticleSystem>()) { ParticleSystem.MainModule pMain = p.main; pMain.startColor = weaponInst.GetLowAlphaColor(); } this.GetComponent <TrailRenderer>().material.SetColor("_TintColor", weaponInst.GetLowAlphaColor()); Destroy(temp, 1); this.GetComponent <MeshFilter>().mesh = ((Weapon)(weaponInst.GetItem())).bulletMesh; colorRenderer = this.GetComponent <Renderer>(); colorRenderer.material.SetColor("_RimColor", ApplyAlphaReduction(weaponInst.GetQualityColor())); colorRenderer.material.SetColor("_InteriorColor", ApplyAlphaReduction(weaponInst.GetLowAlphaColor())); }
public void Setup() { if (!isServer) { //Debug.Log(itemInst.aNumber); //Debug.Log (itemInst.itemID); } gameObject.GetComponent <ParticleSystemRenderer>().material.mainTexture = itemInst.GetItem().icon.texture; gameObject.GetComponent <ParticleSystemRenderer>().material.SetTexture("_Outline", itemInst.GetItem().iconOutline.texture); gameObject.GetComponent <ParticleSystemRenderer>().material.SetColor("_OutlineColor", itemInst.GetQualityColor()); //Debug.Log (Shader.PropertyToID ("Outline Color")); // TODO Experiment with finding the int above for efficiency gameObject.SetActive(true); gameObject.name = itemInst.GetItem().baseName + " Drop"; //ItemHolder itemHolder = gameObject.GetComponent<ItemHolder> (); //itemHolder.item = item; }