private Chunk makeDefaultChunk(int chunkXcoord, int chunkYcoord) { Floor.Type typeOfFloor = Floor.Type.Asphalt; Block.Type typeOfEdgeBlock = Block.Type.wCement; string typeOfFloorName = typeOfFloor.ToString(); string typeOfBlockName = Block.toStrings[typeOfEdgeBlock]; Chunk chunk = new GameObject().AddComponent <Chunk>(); chunk.name = "Default chunk " + chunkXcoord + ", " + chunkYcoord; chunk.chunkX = chunkXcoord; chunk.chunkY = chunkYcoord; chunk.width = chunkSize; chunk.height = chunkSize; chunk.init(); chunks.Add(new global::Point(chunkXcoord, chunkYcoord), chunk); for (int x = 0; x < chunkSize; x++) { for (int y = 0; y < chunkSize; y++) { chunk.setFloor(x, y, typeOfFloor, typeOfFloorName); if (x == 0 || y == 0 || x == chunkSize - 1 || y == chunkSize - 1) { setBlock(chunkXcoord, chunkYcoord, x, y, typeOfEdgeBlock, false, typeOfBlockName); } } } return(chunk); }
public static PromiseWrapper Wrap <T>(Promise <T> promise, string name = "Promise") { var wrapper = new GameObject(name).AddComponent <PromiseWrapper>(); wrapper.init(promise.Wrap <object>()); return(wrapper); }
public void init(GUIWorld ui) { this.ui = ui; this.gameObject.layer = LayerMask.NameToLayer("UI"); sr = gameObject.AddComponent <SpriteRenderer> (); sr.sprite = Resources.Load <Sprite> ("Sprites/UI/T_MainPanelNoIcons"); // HEALTH FEATURE hf = new GameObject("Health Feature").AddComponent <UIHealthFeature>(); hf.init(ui); hf.transform.parent = transform; hf.transform.localPosition = new Vector3(0, -0.3f, -1); hf.transform.localScale = new Vector3(0.75f, 0.75f, 1); // CARDS cards = new List <UICard> (); for (int i = 0; i < 5; i++) { UICard c = new GameObject("Card").AddComponent <UICard> (); c.init(ui, i); c.transform.localPosition = new Vector3(0, 1, 0); c.transform.parent = transform; cards.Add(c); } }
/* * _ = normal * W = wall * w = water * e = end tile * p = player * m = melee * r = range * M = big melee * 0...9 = chest types */ public static WorldMap Default(Layout l, GameManager gm) { WorldMap w = new WorldMap(l, gm); for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { w.addHex(new HexLoc(i, j)); } } var hero = new GameObject("Tim").AddComponent <HeroUnit>(); hero.init(w, w.map[new HexLoc(0, 0)]); w.hero = hero; var renemy = new GameObject("RangedEvilTim").AddComponent <RangedEnemy>(); renemy.init(w, w.map[new HexLoc(5, 5)]); var menemy = new GameObject("MeleeEvilTim").AddComponent <MeleeEnemy>(); menemy.init(w, w.map[new HexLoc(5, 6)]); return(w); }
private Chunk makeRandomBlocksChunk(int chunkXcoord, int chunkYcoord, float densityOfBlocks) { Floor.Type typeOfFloor = Floor.Type.Asphalt; string typeOfFloorName = typeOfFloor.ToString(); Chunk chunk = new GameObject().AddComponent <Chunk>(); chunk.name = "Random chunk " + chunkXcoord + ", " + chunkYcoord; chunk.chunkX = chunkXcoord; chunk.chunkY = chunkYcoord; chunk.width = chunkSize; chunk.height = chunkSize; chunk.init(); chunks.Add(new global::Point(chunkXcoord, chunkYcoord), chunk); for (int x = 0; x < chunkSize; x++) { for (int y = 0; y < chunkSize; y++) { chunk.setFloor(x, y, typeOfFloor, typeOfFloorName); if (Random.Range(0f, 1f) < densityOfBlocks) { if (Random.Range(0f, 1f) < 0.5) { setBlock(chunkXcoord, chunkYcoord, x, y, Block.Type.wIce, false, "ice wall"); } else { setBlock(chunkXcoord, chunkYcoord, x, y, Block.Type.wFlesh, false, "flesh wall"); } } } } return(chunk); }
public override WorldMap GetMap(GameManager gm) { WorldMap world = SaveManager.LoadLevel(GameManager.l, "forest", gm); // TUTORIAL TRIGGERS int i = 0; HexLoc[] tlocs = new HexLoc[] { new HexLoc(0, 3, -3), new HexLoc(2, 2, -4), new HexLoc(3, 4, -7), new HexLoc(6, 8, -14), new HexLoc(7, 9, -16), new HexLoc(12, 11, -23), new HexLoc(23, 2, -25), }; foreach (HexLoc hl in tlocs) { TutorialTrigger tt = new GameObject("Tutorial Trigger").AddComponent <TutorialTrigger>(); tt.init(world.map[hl]); tt.id = i; i++; } return(world); }
public override void OnPlay(WorldMap wm, Hex h) { var trap = new GameObject("Trap Card").AddComponent <TrapTrigger>(); trap.init(h); wm.triggers.Add(trap); }
public void makeUnit(Actor p, HexLoc loc) { Unit u = new GameObject("Unit").AddComponent <Unit> (); u.init(p, this, map [loc]); units.Add(u); UnityEngine.Debug.Log("Added Unit at " + loc.ToString()); }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static WP8RateUsPopUp Create(string title, string message) { WP8RateUsPopUp popup = new GameObject("WP8RateUsPopUp").AddComponent<WP8RateUsPopUp>(); popup.title = title; popup.message = message; popup.init(); return popup; }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static WP8Dialog Create(string title, string message) { WP8Dialog dialog; dialog = new GameObject("WP8Dialog").AddComponent<WP8Dialog>(); dialog.title = title; dialog.message = message; dialog.init(); return dialog; }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static MNWP8Message Create(string title, string message) { MNWP8Message dialog; dialog = new GameObject("WP8Message").AddComponent<MNWP8Message>(); dialog.title = title; dialog.message = message; dialog.init(); return dialog; }
public void Create() { foreach (UnorderedPair <HexLoc> h in cons) { var m = new GameObject("Beam Model").AddComponent <BeamModel> (); m.init(this, h); models.Add(m); } }
public static AndroidMessage Create(string title, string message, string ok) { AndroidMessage message2 = new GameObject("AndroidMessagePopup").AddComponent <AndroidMessage>(); message2.title = title; message2.message = message; message2.ok = ok; message2.init(); return(message2); }
public static MNAndroidDialog Create(string title, string message, string yes, string no) { MNAndroidDialog dialog; dialog = new GameObject("AndroidPopUp").AddComponent<MNAndroidDialog>(); dialog.title = title; dialog.message = message; dialog.yes = yes; dialog.no = no; dialog.init(); return dialog; }
public static AndroidDialog Create(string title, string message, string yes, string no) { AndroidDialog dialog = new GameObject("AndroidDialogPopup").AddComponent <AndroidDialog>(); dialog.title = title; dialog.message = message; dialog.yes = yes; dialog.no = no; dialog.init(); return(dialog); }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static MNWP8Dialog Create(string title, string message) { MNWP8Dialog dialog; dialog = new GameObject("WP8Dialog").AddComponent <MNWP8Dialog>(); dialog.title = title; dialog.message = message; dialog.init(); return(dialog); }
public static IOSDialog Create(string title, string message, string yes, string no) { IOSDialog dialog; dialog = new GameObject("IOSPopUp").AddComponent<IOSDialog>(); dialog.title = title; dialog.message = message; dialog.yes = yes; dialog.no = no; dialog.init(); return dialog; }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static WP8RateUsPopUp Create(string title, string message) { WP8RateUsPopUp popup = new GameObject("WP8RateUsPopUp").AddComponent <WP8RateUsPopUp>(); popup.title = title; popup.message = message; popup.init(); return(popup); }
//-------------------------------------- // INITIALIZE //-------------------------------------- public static WP8Message Create(string title, string message) { WP8Message dialog; dialog = new GameObject("WP8Message").AddComponent <WP8Message>(); dialog.title = title; dialog.message = message; dialog.init(); return(dialog); }
public static MNAndroidMessage Create(string title, string message, string ok) { MNAndroidMessage dialog; dialog = new GameObject("AndroidPopUp").AddComponent<MNAndroidMessage>(); dialog.title = title; dialog.message = message; dialog.ok = ok; dialog.init(); return dialog; }
public Hex addHex(HexLoc hl) { Hex h = new GameObject("Hex " + hl.ToString()).AddComponent <Hex> (); h.init(this, hl); h.transform.parent = hexes.transform; map.Add(hl, h); return(h); }
public static IOSMessage Create(string title, string message, string ok) { IOSMessage dialog; dialog = new GameObject("IOSMessagePopUp").AddComponent <IOSMessage>(); dialog.title = title; dialog.message = message; dialog.ok = ok; dialog.init(); return(dialog); }
public static AndroidRateUsPopUp Create(string title, string message, string rate, string remind, string declined) { AndroidRateUsPopUp androidRateUsPopUp = new GameObject("AndroidRateUsPopUp").AddComponent <AndroidRateUsPopUp>(); androidRateUsPopUp.title = title; androidRateUsPopUp.message = message; androidRateUsPopUp.rate = rate; androidRateUsPopUp.remind = remind; androidRateUsPopUp.declined = declined; androidRateUsPopUp.init(); return(androidRateUsPopUp); }
private void asleepAnimation() { asleepTimer += Time.deltaTime; if (zz.Count < 3 && asleepTimer >= nextZ) { FloatingZ newZ = new GameObject("floating z").AddComponent <FloatingZ>(); newZ.transform.parent = status.u.transform; newZ.init(status.u); zz.Add(newZ); nextZ += zInterval; } }
public void makeMiasma(HexLoc loc, int aggression) { if (map [loc].miasma != null) { return; } Miasma m = new GameObject("Miasma").AddComponent <Miasma> (); m.init(this, map [loc], aggression); UnityEngine.Debug.Log("Added Miasma at " + loc.ToString()); }
public static IOSRateUsPopUp Create(string title, string message, string rate, string remind, string declined) { IOSRateUsPopUp popup = new GameObject("IOSRateUsPopUp").AddComponent<IOSRateUsPopUp>(); popup.title = title; popup.message = message; popup.rate = rate; popup.remind = remind; popup.declined = declined; popup.init(); return popup; }
public static AndroidMessage Create(string title, string message, string ok, AndroidDialogTheme theme) { AndroidMessage dialog; dialog = new GameObject("AndroidPopUp").AddComponent <AndroidMessage>(); dialog.title = title; dialog.message = message; dialog.ok = ok; dialog.init(theme); return(dialog); }
public static MobileDialogInfo Create(string title, string message, string ok, Action okAction) { MobileDialogInfo dialog; dialog = new GameObject("MobileDialogInfo").AddComponent <MobileDialogInfo>(); dialog.title = title; dialog.message = message; dialog.ok = ok; dialog.okAction = okAction; dialog.init(); return(dialog); }
public static IOSRateUsPopUp Create(string title, string message, string rate, string remind, string declined) { IOSRateUsPopUp popup = new GameObject("IOSRateUsPopUp").AddComponent <IOSRateUsPopUp>(); popup.title = title; popup.message = message; popup.rate = rate; popup.remind = remind; popup.declined = declined; popup.init(); return(popup); }
// Constructor public static MobileDialogConfirm Create(string title, string message, string yes, string no, Action yesAction, Action noAction) { MobileDialogConfirm dialog; dialog = new GameObject("MobileDialogConfirm").AddComponent <MobileDialogConfirm>(); dialog.title = title; dialog.message = message; dialog.yes = yes; dialog.no = no; dialog.yesAction = yesAction; dialog.noAction = noAction; dialog.init(); return(dialog); }
// TODO // Glorious "You've got mail message box" public override void UnitEnter(Unit u) { if (u.GetType() == typeof(HeroUnit)) { AudioManager.playerVictory(); UIManager.gc.SetLock(true); var menu = new GameObject("Continue Menu").AddComponent <UIContinueMenu> (); menu.transform.parent = UIManager.gc.transform; menu.transform.localPosition = new Vector3(0, 0, Layer.HUD); menu.init(); //endingGame = true; } }
public static MNAndroidRateUsPopUp Create(string title, string message, string url, string yes, string later, string no) { MNAndroidRateUsPopUp rate = new GameObject("AndroidRateUsPopUp").AddComponent<MNAndroidRateUsPopUp>(); rate.title = title; rate.message = message; rate.url = url; rate.yes = yes; rate.later = later; rate.no = no; rate.init(); return rate; }
public override void OnPlay(WorldMap wm, Hex h) { if (h.unit != null) { h.unit.health = 0; h.unit.CheckDeath(); } var boulder = new GameObject("Boulder").AddComponent <BoulderUnit>(); boulder.init(wm, h); Debug.Log("Hex: " + h); Debug.Log("Hex.unit: " + h.unit); }
public void init(string message) { // BACKGROUND sr = gameObject.AddComponent <SpriteRenderer>(); sr.sprite = Resources.Load <Sprite>("Sprites/UI/T_Wood"); // CONTINUE BUTTON UIButton cb = new GameObject("Continue Button").AddComponent <UIButton>(); cb.init(Resources.Load <Sprite>("Sprites/UI/T_Wood"), ContinueFunc); cb.transform.parent = transform; cb.transform.localPosition = new Vector3(0, -.75f, 0); cb.transform.localScale = new Vector3(.5f, .5f, 1); }
public static MNAndroidRateUsPopUp Create(string title, string message, string url, string yes, string later, string no) { MNAndroidRateUsPopUp rate = new GameObject("AndroidRateUsPopUp").AddComponent <MNAndroidRateUsPopUp>(); rate.title = title; rate.message = message; rate.url = url; rate.yes = yes; rate.later = later; rate.no = no; rate.init(); return(rate); }
public static MobileDialogNeutral Create(string title, string message, string accept, string neutral, string decline, Action acceptAction, Action neutralAction, Action declineAction) { MobileDialogNeutral dialog = new GameObject("MobileDialogNeutral").AddComponent <MobileDialogNeutral>(); dialog.title = title; dialog.message = message; dialog.accept = accept; dialog.neutral = neutral; dialog.decline = decline; dialog.acceptAction = acceptAction; dialog.neutralAction = neutralAction; dialog.declineAction = declineAction; dialog.init(); return(dialog); }
public bool spawnMeleeEnemy() { foreach (MeleeEnemy e in minions.ToArray()) { if (e == null) { minions.Remove(e); } } if (minions.Count < maxMinions) { List <Hex> neighbs = h.Neighbors(); List <Hex> openNeighbs = new List <Hex>(); foreach (Hex neighb in neighbs) { if (neighb.Passable() && neighb.unit == null) { openNeighbs.Add(neighb); } } if (openNeighbs.Count > 0) { System.Random rng = new System.Random(); int i = rng.Next(openNeighbs.Count); MeleeEnemy minion = new GameObject("MeleeEvilTim").AddComponent <MeleeEnemy>(); minion.init(w, openNeighbs[i]); minion.setPersuing(); minion.Updated = true; minions.Add(minion); w.enemies.Add(minion); return(true); } else { return(false); } } else { return(false); } }