public void init(CellType _cellType,BombType _cellBombType,CellColor _cellColor) { string spritePath = _cellType.ToString() +_cellBombType.ToString()+ _cellColor.ToString(); Sprite newSprite = Resources.Load("Sprite/Cells/"+spritePath,typeof(Sprite)) as Sprite; GetComponent<SpriteRenderer>().sprite = newSprite; }
IEnumerator DoUpdateCell(float delayTime) { yield return(new WaitForSeconds(delayTime)); string spritePath = _unitType.ToString() + _bombType.ToString() + _unitColor.ToString(); Sprite newSprite = Resources.Load("Sprite/Cells/" + spritePath, typeof(Sprite)) as Sprite; GetComponent <SpriteRenderer>().sprite = newSprite; }
private BombAsset LoadBombAssetOrPanic(BombType type) { string path = BOMB_OBJECTS_PATH_PREFIX + type.ToString() /*+ ASSET_FILE_TYPE*/; BombAsset bombAsset = Resources.Load<BombAsset>(path); if(bombAsset == null) throw new System.Exception("Load BombAsset of BombType: " + type + " from path: " + path + " failed"); return bombAsset; }
public void ChangeBombTypeFrequence(BombType ut, int freq) { var e = _root.Elements("Game").Where(c => String.Compare(Type.ToString(), c.Attribute("type").Value) == 0).Descendants("Upgrades");//.FirstOrDefault(c => String.Compare(ut.ToString(), c.Element("Upgrade").Value) == 0); XElement theut = null; foreach (var element in e.Elements("BombType").Where(element => String.Compare(ut.ToString(), element.Value) == 0)) { theut = element; } if (theut != null) { theut.Attribute("currentFreq").Value = freq + ""; } }
Color GetBombColour(BombType type) { switch(type) { case BombType.speed: return speedCol; case BombType.blastpower: return blastCol; case BombType.threatlvl: return threatCol; case BombType.timeslow: return timeCol; default: Debug.LogError("Unknown bomb colour requested " + type.ToString()); return Color.white; } }