public void SetFrame(ItemInstance i) { if (!i.isSetup() || i.GetItem().icon == null) { icon.sprite = iconOriginal; } else { icon.sprite = i.GetItem().icon; } if (i.isSetup()) { frame.color = i.GetHalfQualityColor(); int netPrimary = i.GetNetPrimary(); primaryStat.sizeDelta = new Vector2(Mathf.Max(1, Mathf.Abs(netPrimary)) * originalWidth, primaryStat.sizeDelta.y); if (netPrimary > 0) { primaryImage.color = Color.green; } else if (netPrimary < 0) { primaryImage.color = Color.red; } else { primaryImage.color = Color.white; } int netSecondary = i.GetNetSecondary(); secondaryStat.sizeDelta = new Vector2(Mathf.Max(1, Mathf.Abs(netSecondary)) * originalWidth, secondaryStat.sizeDelta.y); if (netSecondary > 0) { secondaryImage.color = Color.green; } else if (netSecondary < 0) { secondaryImage.color = Color.red; } else { secondaryImage.color = Color.white; } itemName.text = i.GetFullName(); itemName.color = i.GetLightQualityColor(); } }
public void CmdGenerateAttack(Vector3 direction, ItemInstance weapon, GameObject targetTransformGO) { GameObject temp = (GameObject)GameObject.Instantiate(basicAttackFlare, transform.position, Quaternion.identity); float damage = ((Weapon)weapon.GetItem()).GetRealDamage(weapon.quality); temp.GetComponent <PlayerAttackBullet> ().Setup(damage, .8f, 0, 5, ForceApplyMode.posDiff, this.gameObject, transform.position, direction, weapon, targetTransformGO); NetworkServer.Spawn(temp); }
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; }
void CheckGrabItem() { if (itemOnTopOf != null && Input.GetKeyDown(KeyCode.E)) { if (itemOnTopOf.itemInst.GetItem().type == ItemType.weapon) { if (weaponInst.GetItem().baseName != "") { DropItem(weaponInst.Clone()); } //TODO make a function so there isn't so much copy pasta //TODO interrupt this perhaps? weaponInst = (itemOnTopOf.itemInst).Clone(); attackAction = GetWeapon().attackDetails; CmdUpdateWeapon(weaponInst); uiControl.UpdateAbilityIconFromItem(ItemType.weapon); actionsController.SetWeaponBasicAttackSpeed(); actionsController.AddWeaponAbility(); DestroyServerItem(itemOnTopOf.gameObject); } else if (itemOnTopOf.itemInst.GetItem().type == ItemType.armor) { if (armorInst.GetItem().baseName != "") { DropItem(armorInst.Clone()); } armorInst = (itemOnTopOf.itemInst).Clone(); movementController.SetupRolls(); CmdUpdateArmor(armorInst); uiControl.UpdateAbilityIconFromItem(ItemType.armor); actionsController.AddArmorAbility(); DestroyServerItem(itemOnTopOf.gameObject); } else if (itemOnTopOf.itemInst.GetItem().type == ItemType.artifact) { if (artifactInst.GetItem().baseName != "") { DropItem(artifactInst.Clone()); } artifactInst = (itemOnTopOf.itemInst).Clone(); CmdUpdateArtifact(artifactInst); uiControl.UpdateAbilityIconFromItem(ItemType.artifact); actionsController.AddArtifactAbility(); DestroyServerItem(itemOnTopOf.gameObject); } } }
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())); }