//Change our index and the part we'll spawn. Called when we make a new monster. public void ChangeEquip(GameObject a_setting, partType a_type, int index) { equip.setEquipped(a_type, index); switch (a_type) { case partType.Torso: currentTorsoPrefab = a_setting; break; case partType.Head: currentHeadPrefab = a_setting; break; case partType.LeftArm: currentLeftArmPrefab = a_setting; break; case partType.RightArm: currentRightArmPrefab = a_setting; break; case partType.LeftLeg: currentLeftLegPrefab = a_setting; break; case partType.RightLeg: currentRightLegPrefab = a_setting; break; default: break; } }
public void setType(int type) { currentType = (partType)type; currentIndex = 0; getPart(); shop.ReadyPart(); Refresh = true; }
// Use this for initialization public void Setup(LevelManager _lm, CollectiblePlaces _place) { base.Setup(_lm); thisType = partType.Spawner; collPlace = _place; name = "Gatepart|" + collPlace.name + Random.Range(0,100).ToString(); PlaceCollectibleToGo = PlacesCollect.Stargate; _animSpr = FETool.findWithinChildren(this.gameObject, "Part").GetComponentInChildren<OTAnimatingSprite>(); Taken = FETool.findWithinChildren(this.gameObject, "Taken").GetComponentInChildren<OTAnimatingSprite>(); Taken.alpha = 0f; Pop(); }
// Use this for initialization internal void Begin(equipmentList a_list) { list = a_list; manager = list.equip; shop.list = list; parts.list = list; shop.Begin(this); parts.Begin(this); currentType = partType.Torso; stars = manager.GetTotalStars(); getPart(); Refresh = true; }
public void setEquipped(partType a_type, int index) { equippedParts[(int)a_type] = index; }
public void addLimb() { combinedShop.Refresh = true; changed = true; GameObject adding; GameObject currentPart = combinedShop.currentPart; //The object, found at the index inside the list. int currentIndex = combinedShop.currentIndex; partType currentType = combinedShop.currentType; if (currentPart == null) { return; } if (currentType == partType.Torso) { addingTorso(); return; } if (TorsoEquipped == null) { return; } switch (currentType) { case partType.Head: if (headEquipped != null && currentPart.name == headEquipped.gameObject.name) { return; } if (headEquipped != null) { Destroy(headEquipped.gameObject); } adding = Instantiate(currentPart, TorsoEquipped.neckForHead.transform, false); headEquipped = adding.GetComponent <ItemPart>(); list.ChangeEquip(currentPart, partType.Head, currentIndex); adding.name = currentPart.name; break; case partType.LeftArm: if (leftArmEquipped != null && currentPart.name == leftArmEquipped.gameObject.name) { return; } if (leftArmEquipped != null) { leftArmEquipped.deleteArm(); } adding = Instantiate(currentPart, TorsoEquipped.LeftArmUpper.transform, false); leftArmEquipped = adding.GetComponent <ArmPart>(); leftArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.LeftArmUpper, TorsoEquipped.LeftArmFore, TorsoEquipped.LeftArmHand); adding.name = currentPart.name; list.ChangeEquip(currentPart, partType.LeftArm, currentIndex); adding = null; break; case partType.RightArm: if (rightArmEquipped != null && currentPart.name == rightArmEquipped.gameObject.name) { return; } if (rightArmEquipped != null) { rightArmEquipped.deleteArm(); } adding = Instantiate(currentPart, TorsoEquipped.RightArmUpper.transform, false); rightArmEquipped = adding.GetComponent <ArmPart>(); rightArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.RightArmUpper, TorsoEquipped.RightArmFore, TorsoEquipped.RightArmHand); adding.name = currentPart.name; list.ChangeEquip(currentPart, partType.RightArm, currentIndex); adding = null; break; case partType.LeftLeg: if (leftLegEquipped != null && currentPart.name == leftLegEquipped.gameObject.name) { return; } if (leftLegEquipped != null) { leftLegEquipped.DeleteLeg(); } adding = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false); leftLegEquipped = adding.GetComponent <LegPart>(); leftLegEquipped.EquipLeg(TorsoEquipped.LeftUpperThigh, TorsoEquipped.Leftshin, TorsoEquipped.LefttAnkle, TorsoEquipped.LeftFoot); list.ChangeEquip(currentPart, partType.LeftLeg, currentIndex); adding.name = currentPart.name; adding = null; break; case partType.RightLeg: if (rightLegEquipped != null && currentPart.name == rightLegEquipped.gameObject.name) { } if (rightLegEquipped != null) { rightLegEquipped.DeleteLeg(); } adding = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false); rightLegEquipped = adding.GetComponent <LegPart>(); rightLegEquipped.EquipLeg(TorsoEquipped.RightUpperThigh, TorsoEquipped.Rightshin, TorsoEquipped.RightAnkle, TorsoEquipped.RightFoot); list.ChangeEquip(currentPart, partType.RightLeg, currentIndex); adding.name = currentPart.name; adding = null; break; default: break; } if (TorsoEquipped.bodyType == BodyType.FourArm) { Destroy(TorsoEquipped.gameObject); list.BuildCharacter(parentOfTorso, this); return; } }