private void CreateBeetle() { int[][] position = GetPosition(); int actor = GetComponent <SchedulingSystem>().CountActor; int maxActor = GetComponent <GameData>().GetIntData("Dungeon", "MaxActor"); if ((position.Length < maxBeetle) || (actor > maxActor)) { return; } position = FilterPosition(position); DungeonLevel dl = GetComponent <DungeonProgressData>() .GetDungeonLevel(); SubObjectTag minion = GetComponent <ActorGroupData>() .GetActorGroup(dl)[CombatRoleTag.Minion][0]; foreach (int[] p in position) { GetComponent <ObjectPool>().CreateObject( MainObjectTag.Actor, minion, p); } }
public bool CheckBlock(SubObjectTag block, int[] position) { int x = position[0]; int y = position[1]; return(CheckBlock(block, x, y)); }
public SubObjectTag[] GetActor() { DungeonProgressData progress = GetComponent <DungeonProgressData>(); DungeonLevel level = progress.GetDungeonLevel(); int maxSoldier = progress.MaxSoldier; int maxActor = progress.MaxActor; int potion = 0; int nextIndex; Stack <SubObjectTag> actors = new Stack <SubObjectTag>(); Dictionary <CombatRoleTag, SubObjectTag[]> group = GetComponent <ActorGroupData>().GetActorGroup(level); SubObjectTag[] soldier = group[CombatRoleTag.Soldier]; SubObjectTag minion = group[CombatRoleTag.Minion][0]; while (potion < maxSoldier) { nextIndex = GetComponent <RandomNumber>().Next( GetComponent <DungeonBlueprint>().Seed, 0, soldier.Length); actors.Push(soldier[nextIndex]); potion += GetComponent <ActorData>().GetIntData( soldier[nextIndex], DataTag.Potion); } while (actors.Count < maxActor) { actors.Push(minion); } return(actors.ToArray()); }
private GameObject CreateBuilding(SubObjectTag tag, int x, int y) { GameObject go; if (pool[tag].Count > 0) { go = pool[tag].Pop(); go.SetActive(true); } else { go = Instantiate(Resources.Load(tag.ToString()) as GameObject); SetTags(MainObjectTag.Building, tag, go); go.AddComponent <RenderSprite>(); } // ObjectPool is attached to GameLogic. go.transform.position = GetComponent <ConvertCoordinates>().Convert(x, y); GetComponent <DungeonBoard>().ChangeBlock(go, x, y); GetComponent <DungeonBoard>().ChangeBlueprint(tag, x, y); return(go); }
public bool CheckBlock(SubObjectTag block, int x, int y) { if (IndexOutOfRange(x, y)) { return(false); } return(blueprint[x, y] == block); }
public void CountKill(GameObject actor) { SubObjectTag tag = actor.GetComponent <MetaInfo>().SubTag; if (actorData.GetIntData(tag, DataTag.Potion) > 0) { kill++; } }
public static GameObject GetStaticActor(SubObjectTag tag) { if (actorDict.TryGetValue(tag, out GameObject checkActor) && (checkActor != null)) { return(checkActor); } Debug.Log(tag.ToString() + " is null."); return(null); }
public bool ChangeBlueprint(SubObjectTag block, int x, int y) { if (IndexOutOfRange(x, y)) { return(false); } blueprint[x, y] = block; return(true); }
public static void SetStaticActor(SubObjectTag tag, GameObject actor) { if (actorDict.TryGetValue(tag, out GameObject checkActor) && (checkActor != null)) { Debug.Log(tag.ToString() + " already exists."); } else { actorDict[tag] = actor; } }
private void CreateDoppleganger() { SubObjectTag[] actors = new SubObjectTag[] { SubObjectTag.Examiner, SubObjectTag.Guide, SubObjectTag.BuyPower, SubObjectTag.ViewHelp, SubObjectTag.ViewLog, SubObjectTag.Setting, SubObjectTag.Opening, }; foreach (SubObjectTag tag in actors) { oPool.CreateObject(MainObjectTag.Doppleganger, tag, -9, 0); } }
public GameObject CreateObject( MainObjectTag mainTag, SubObjectTag subTag, int x, int y) { switch (mainTag) { case MainObjectTag.Actor: return(CreateActor(subTag, x, y)); case MainObjectTag.Building: return(CreateBuilding(subTag, x, y)); case MainObjectTag.Doppleganger: return(CreateDoppleganger(subTag, x, y)); default: return(null); } }
public void DefeatTarget(GameObject target) { SubObjectTag tag = target.GetComponent <MetaInfo>().SubTag; int potion = actorData.GetIntData(tag, DataTag.Potion); int bonusPotion = target.GetComponent <Infection>().HasInfection( InfectionTag.Mutated) ? potionData.BonusPotion : 0; string victory; GetComponent <Potion>().GainPotion(potion + bonusPotion); progress.CountKill(target); if (progress.IsWin()) { BurySelf(); color.ChangeObjectColor(getActor(SubObjectTag.Guide), ColorName.Orange); if (progressData.IsRushMode) { victory = text.GetStringData(node, "WinRush"); } else { victory = text.GetStringData(node, "WinNormal"); } victory = color.GetColorfulText(victory, ColorName.Green); message.StoreText(victory); modeline.PrintStaticText(text.GetStringData(node, "ReloadWin")); } else if (progress.LevelCleared()) { BurySelf(); color.ChangeObjectColor(getActor(SubObjectTag.Guide), ColorName.Orange); victory = text.GetStringData(node, "Level"); victory = color.GetColorfulText(victory, ColorName.Green); message.StoreText(victory); modeline.PrintStaticText(text.GetStringData(node, "Continue")); } }
public bool CheckBlock(SubObjectTag block, Vector3 position) { int[] index = coordinate.Convert(position); return(CheckBlock(block, index[0], index[1])); }
private void Start() { actorData = FindObjects.GameLogic.GetComponent <ActorData>(); actorTag = GetComponent <MetaInfo>().SubTag; }
public bool CanSeeTarget(SubObjectTag targetTag) { return(CanSeeTarget <SubObjectTag>(targetTag)); }
private GameObject CreateActor(SubObjectTag tag, int x, int y) { GameObject go; if ((pool[tag].Count > 0) && (tag != SubObjectTag.PC)) { go = pool[tag].Pop(); go.GetComponent <Energy>().Reset(); go.GetComponent <HP>().Reset(); go.GetComponent <Infection>().Reset(); go.GetComponent <Stress>().Reset(); go.SetActive(true); go.GetComponent <NPCAction>().enabled = false; } else { go = Instantiate(Resources.Load(tag.ToString()) as GameObject); SetTags(MainObjectTag.Actor, tag, go); go.AddComponent <AIVision>(); go.AddComponent <AutoExplore>(); go.AddComponent <Attack>(); go.AddComponent <Energy>(); go.AddComponent <FieldOfView>(); go.AddComponent <FOVRhombus>(); //go.AddComponent<FOVSimple>(); go.AddComponent <HP>(); go.AddComponent <Infection>(); go.AddComponent <InfectionRate>(); go.AddComponent <InternalClock>(); go.AddComponent <MoveActor>(); go.AddComponent <RenderSprite>(); go.AddComponent <Stress>(); //go.AddComponent<TileOverlay>(); if (tag == SubObjectTag.PC) { go.AddComponent <InputNormal>(); go.AddComponent <PCAction>(); go.AddComponent <PCAutoExplore>(); go.AddComponent <PCDamage>(); go.AddComponent <PCDeath>(); go.AddComponent <PCEnergy>(); go.AddComponent <PCHP>(); go.AddComponent <PCInfection>(); go.AddComponent <PCInternalClock>(); go.AddComponent <PCMessage>(); go.AddComponent <PlayerInput>(); go.AddComponent <Power>(); go.AddComponent <Potion>(); go.AddComponent <TurnIndicator>(); FindObjects.PC = go; } else { go.AddComponent <ActorAI>(); go.AddComponent <NPCAutoExplore>(); go.AddComponent <NPCDamage>(); go.AddComponent <NPCDeath>(); go.AddComponent <NPCEnergy>(); go.AddComponent <NPCHP>(); go.AddComponent <NPCInfection>(); go.AddComponent <NPCInternalClock>(); go.AddComponent <NPCMessage>(); //go.AddComponent<NPCMemory>(); go.AddComponent <NPCAction>().enabled = false; // NOTE: Change sprite. //UnityEngine.Object[] test // = Resources.LoadAll("curses_vector_32x48", typeof(Sprite)); //go.GetComponent<SpriteRenderer>().sprite = (Sprite)test[5]; } } go.transform.position = GetComponent <ConvertCoordinates>().Convert(x, y); GetComponent <ActorBoard>().AddActor(go, x, y); GetComponent <DungeonTerrain>().ChangeStatus(false, x, y); GetComponent <SchedulingSystem>().AddActor(go); return(go); }
public GameObject CreateObject( MainObjectTag mainTag, SubObjectTag subTag, int[] position) { return(CreateObject(mainTag, subTag, position[0], position[1])); }
private void SetTags(MainObjectTag main, SubObjectTag sub, GameObject go) { go.AddComponent <MetaInfo>(); go.GetComponent <MetaInfo>().SetMainTag(main); go.GetComponent <MetaInfo>().SetSubTag(sub); }
public ActorInfoEventArgs(SubObjectTag actorTag, int[] position) { ActorTag = actorTag; Position = position; }
private GameObject CreateDoppleganger(SubObjectTag tag, int x, int y) { GameObject go = Instantiate(Resources.Load(tag.ToString()) as GameObject); FindObjects.SetStaticActor(tag, go); go.transform.position = GetComponent <ConvertCoordinates>().Convert(x, y); SetTags(MainObjectTag.Actor, tag, go); go.AddComponent <PlayerInput>(); switch (tag) { // These actors appear on screen even when activated. case SubObjectTag.Examiner: go.AddComponent <ExaminerAction>(); go.AddComponent <InputExamine>(); go.AddComponent <MoveExamineMarker>(); go.AddComponent <PCSortTargets>(); go.SetActive(false); break; case SubObjectTag.Guide: go.AddComponent <GuideAction>(); go.AddComponent <InputGuide>(); go.SetActive(false); break; // These actors do not appear on screen even when activated. case SubObjectTag.BuyPower: go.AddComponent <BuyPowerAction>(); go.AddComponent <BuyPowerStatus>(); go.AddComponent <InputHeader>(); go.AddComponent <InputBuyPower>(); go.GetComponent <BuyPowerAction>().enabled = false; break; case SubObjectTag.ViewHelp: go.AddComponent <ViewHelpAction>(); go.AddComponent <ViewHelpStatus>(); go.AddComponent <InputHeader>(); go.GetComponent <ViewHelpAction>().enabled = false; break; case SubObjectTag.ViewLog: go.AddComponent <ViewLogAction>(); go.AddComponent <ViewLogStatus>(); go.AddComponent <InputHeader>(); go.GetComponent <ViewLogAction>().enabled = false; break; case SubObjectTag.Setting: go.AddComponent <SettingAction>(); go.AddComponent <SettingStatus>(); go.AddComponent <InputHeader>(); go.AddComponent <InputSetting>(); go.GetComponent <SettingAction>().enabled = false; break; case SubObjectTag.Opening: go.AddComponent <OpeningAction>(); go.AddComponent <InputOpening>(); go.GetComponent <OpeningAction>().enabled = false; break; } return(go); }
public void SetSubTag(SubObjectTag tag) { SubTag = tag; }