//add an object to the Progress Map, parameters are the prefab to be drawn on the map //and the gameobject ID for later access by a unique key. Called by TweenMove.cs in OnSpawn() public static void AddToMap(GameObject mapObjectPrefab, int objID) { //let PoolManager spawn the map icon prefab at the starting position of the map GameObject newObj = PoolManager.Pools["PM_StartingPoint"].Spawn(mapObjectPrefab, Vector3.zero, Quaternion.identity); //get ProgressMapObject component of this map icon prefab ProgressMapObject newMapObj = newObj.GetComponent <ProgressMapObject>(); //add this enemy with its ID and properties to the dictionary ProgressMap.objDic.Add(objID, newMapObj); }
internal IEnumerator Remove(int objID) { //cache ProgressMapObject script reference ProgressMapObject pMapObj = objDic[objID]; //remove it from our dictionary objDic.Remove(objID); //change sprite to the one indicating this object/enemy died pMapObj.image.sprite = pMapObj.objDeadSprite; //wait 2 seconds (display the death icon for 2 seconds) yield return(new WaitForSeconds(2)); //remove this ui element from our scene PoolManager.Pools["PM_StartingPoint"].Despawn(pMapObj.gameObject); }