public void addLifePack(LifePack lp) { pendingLP = lp; }
public void processLifePack() { if (pendingLP == null) { return; } LifePack lp = pendingLP; pendingLP = null; UnityEngine.Object o = Instantiate(lifePackPrefab, new Vector3(lp.Pos.X * 2f, 0.5f, lp.Pos.Y * 2f), Quaternion.identity); GameObject go = (GameObject)o; LifePackPerfab lifePackPerf = go.GetComponent<LifePackPerfab>(); lifePackPerf.lifetime = lp.Seconds; lifePackPerf.position = lp.Pos; Destroy(go, lp.Seconds / 1000.0f); lpMap.Add(lp.Pos, go); }
void removeTakenLP(Point playerPos) { LifePack[] tempList = new LifePack[navigator.gameInstance.getLifePacks().Count]; navigator.gameInstance.getLifePacks().CopyTo(tempList); foreach (LifePack c in tempList) { if (playerPos == c.Pos) { Destroy(lpMap[playerPos]); navigator.gameInstance.removeLifePack(playerPos); lpMap.Remove(playerPos); } } }
public void addLifePack(Point loc, int sec) { LifePack lp = new LifePack(loc, sec); lifePacks.Add(lp); navigator.map.addLifePack(lp); }