예제 #1
0
        protected override async Task <bool> OnApply(IGameState gameState)
        {
            var success = await BuildStructure.OnExecute();

            if (!success)
            {
                return(false);
            }

            var allVinesBeforePlanting = gameState.Hand.Vines.ToList();

            success = await PlantVine.OnExecute();

            if (!success)
            {
                return(false);
            }

            var allVinesAfterPlanting = gameState.Hand.Vines.ToList();
            var plantedVine           = allVinesBeforePlanting.Except(allVinesAfterPlanting).Single();

            if (plantedVine.WhiteValue + plantedVine.RedValue == 4)
            {
                gameState.VictoryPoints++;
            }

            return(true);
        }
        private void UpdateDoorHp(BuildStructure structure)
        {
            switch (structure.structureName) {
                case "Fence Gate":
                    structure.health = SettingsManager.CurrentFenceHp;
                    break;
                case "Timber Door":
                    structure.health = SettingsManager.CurrentTimberHp;
                    break;
                case "Braced Door":
                    structure.health = SettingsManager.CurrentBracedHp;
                    break;
                case "Studded Door":
                    structure.health = SettingsManager.CurrentStuddedHp;
                    break;
                case "Dungeon Door":
                    structure.health = SettingsManager.CurrentDungeonHp;
                    break;
                case "Castle Arch Gate":
                case "Castle Gate":
                    structure.health = SettingsManager.CurrentCastleHp;
                    break;
            }

            if (SettingsManager.BoolSettings[(int)Preferences.ShowDoorInfo]) {
                GUIManager.getInstance().AddTextLine(structure.structureName + " has " + structure.health + " health.");
            }
        }
        private void DrawHpBarAboveStructure(BuildStructure structure)
        {
            if (!structure.isBuilt) return;

            float hpPrecent = 0f;

            switch (structure.structureName) {
                case "Fence Gate":
                    hpPrecent = structure.health / SettingsManager.CurrentFenceHp;
                    break;
                case "Timber Door":
                    hpPrecent = structure.health / SettingsManager.CurrentTimberHp;
                    break;
                case "Braced Door":
                    hpPrecent = structure.health / SettingsManager.CurrentBracedHp;
                    break;
                case "Studded Door":
                    hpPrecent = structure.health / SettingsManager.CurrentStuddedHp;
                    break;
                case "Dungeon Door":
                    hpPrecent = structure.health / SettingsManager.CurrentDungeonHp;
                    break;
                case "Castle Arch Gate":
                case "Castle Gate":
                    hpPrecent = structure.health / SettingsManager.CurrentCastleHp;
                    break;
            }

            if (hpPrecent != 1f) {
                Vector3 vector = Camera.main.WorldToViewportPoint(structure.transform.position + new Vector3(0f, 0.6f, 0f));
                guiMgr.DrawProgressBar(new Rect(Screen.width * vector.x - 40f, Screen.height - Screen.height * vector.y, 80f, 16f), hpPrecent, true);
            }
        }
예제 #4
0
 protected override Task <bool> ApplyOption2(IGameState gameState)
 {
     BuildStructure.BuildingBonus = 1;
     return(BuildStructure.OnExecute());
 }