void Start() { units = new List <EnemySquad> (); Waypoints = new Dictionary <Waypoint, Vector3> (); Waypoints.Add(Waypoint.BottomLeft, GameObject.Find("WP_BottomLeft").transform.position); Waypoints.Add(Waypoint.BottomRight, GameObject.Find("WP_BottomRight").transform.position); Waypoints.Add(Waypoint.TopRight, GameObject.Find("WP_TopRight").transform.position); Waypoints.Add(Waypoint.TopLeft, GameObject.Find("WP_TopLeft").transform.position); Waypoints.Add(Waypoint.CenterRight, GameObject.Find("WP_CenterRight").transform.position); Waypoints.Add(Waypoint.CenterLeft, GameObject.Find("WP_CenterLeft").transform.position); Waypoints.Add(Waypoint.CenterDown, GameObject.Find("WP_CenterDown").transform.position); Waypoints.Add(Waypoint.CenterUp, GameObject.Find("WP_CenterUp").transform.position); Waypoints.Add(Waypoint.King, GameObject.Find("WP_King").transform.position); Waypoints.Add(Waypoint.Center, GameObject.Find("WP_Center").transform.position); Waypoints.Add(Waypoint.SpawnLeft, GameObject.Find("WP_SpawnLeft").transform.position); Waypoints.Add(Waypoint.SpawnCenter, GameObject.Find("WP_SpawnCenter").transform.position); Waypoints.Add(Waypoint.SpawnRight, GameObject.Find("WP_SpawnRight").transform.position); GameObject.Find("Waypoints").SetActive(false); string aiDataPath = "Data/AI/AI_"; aiDataPath += GameEra.ToString(); aiDataPath += "_"; aiDataPath += GameLevel.ToString(); aiDataPath += ".txt"; ReadWavesFromFile(aiDataPath); mCurrentWave = 1; this.SpawnWave(mCurrentWave); }
public void Freeze(Unit unit) { mUnit = unit; Era era = GameState.GameEra; string iceBlockPrefab = "Weapons/" + era.ToString() + "_IceBlockPrefab"; mFrozenEffectPrefab = Resources.Load(iceBlockPrefab) as GameObject; mStartTimer = Time.time; mIceBlock = (GameObject)Instantiate(mFrozenEffectPrefab); if (unit is Elite) { unit.BuffMovement(0.7f, mDuration); } else { unit.BuffMovement(0.3f, mDuration); } FollowUnit(); mIsInitialized = true; }
void Start() { if (KingsHealthBar == null || SwordsmanExperienceBar == null || MageExperienceBar == null || ArcherExperienceBar == null) { Debug.LogError("Experience and health bars need to be attached to the game manager!"); } mExpBars = new Dictionary <UnitType, Progressbar> (); mExpBars.Add(UnitType.Archer, ArcherExperienceBar); mExpBars.Add(UnitType.Swordsman, SwordsmanExperienceBar); mExpBars.Add(UnitType.Mage, MageExperienceBar); mLevelText = new Dictionary <UnitType, GUIText>(); mLevelText.Add(UnitType.Archer, ArcherLevel); mLevelText.Add(UnitType.Swordsman, SwordsmanLevel); mLevelText.Add(UnitType.Mage, MageLevel); KingsHealthBar.MaxValue = GameState.KingsHealth; // TODO refactor these hard coded values SpriteRenderer sr = GameObject.Find("ControlPanel").GetComponent <SpriteRenderer>(); Era era = GameState.GameEra; string controlPanelSpritePath = "UI/Textures/" + era.ToString() + "UI"; sr.sprite = Resources.Load <Sprite>(controlPanelSpritePath); }
private static GameObject UnitPrefab(Era era, string name) { string prefabPath = "Units/Prefabs/"; prefabPath += era.ToString(); prefabPath += "/"; prefabPath += name; return Resources.Load (prefabPath) as GameObject; }
private static GameObject UnitPrefab(Era era, string name) { string prefabPath = "Units/Prefabs/"; prefabPath += era.ToString(); prefabPath += "/"; prefabPath += name; return(Resources.Load(prefabPath) as GameObject); }
private static string FormatLevelData(UnitType unitType, Era era) { string data = ""; data += String.Format("{0,-20}", unitType.ToString()); data += " "; data += String.Format("{0,-20}", era.ToString()); data += " "; data += String.Format("{0,5}", mUnitLevels[(int)unitType, (int)era]); data += " "; data += String.Format("{0,5}", mUnitExperience[(int)unitType, (int)era]); return(data); }
private static string FormatLevelData(UnitType unitType, Era era) { string data = ""; data += String.Format("{0,-20}", unitType.ToString()); data += " "; data += String.Format("{0,-20}", era.ToString()); data += " "; data += String.Format("{0,5}", mUnitLevels[(int) unitType, (int) era]); data += " "; data += String.Format("{0,5}", mUnitExperience[(int) unitType, (int) era]); return data; }