Inheritance: MonoBehaviour
Example #1
0
	// Use this for initialization
	void Start () {
        CurrentLevel = 3;

        instance = this;
        _temple = FindObjectOfType<Temple>();

    }
Example #2
0
            public override string God()
            {
                int factionId = 0;

                // Get the temple faction ID if player is inside a temple
                if (GameManager.Instance.IsPlayerInsideBuilding &&
                    GameManager.Instance.PlayerEnterExit.BuildingType == DFLocation.BuildingTypes.Temple)
                {
                    factionId = (int)GameManager.Instance.PlayerEnterExit.FactionID;
                }
                else
                {
                    factionId = GameManager.Instance.PlayerGPS.GetTempleOfCurrentRegion();
                }

                if (factionId == 0)
                {
                    // Classic returns "BLANK" if no temple is found, here we return a random deity name
                    const int minGodID = 21;
                    const int maxGodID = 35;

                    FactionFile.FactionIDs god = (FactionFile.FactionIDs)UnityEngine.Random.Range(minGodID, maxGodID + 1);
                    return(god.ToString());
                }

                Temple.Divines divine = Temple.GetDivine(factionId);
                return(TextManager.Instance.GetLocalizedText(divine.ToString()));
            }
        private List <DFCareer.Skills> GetTrainingSkills()
        {
            switch (npcService)
            {
            // Handle Temples even when not a member
            case GuildNpcServices.TAk_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Akatosh));

            case GuildNpcServices.TAr_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Arkay));

            case GuildNpcServices.TDi_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Dibella));

            case GuildNpcServices.TJu_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Julianos));

            case GuildNpcServices.TKy_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Kynareth));

            case GuildNpcServices.TMa_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Mara));

            case GuildNpcServices.TSt_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Stendarr));

            case GuildNpcServices.TZe_Training:
                return(Temple.GetTrainingSkills(Temple.Divines.Zenithar));

            default:
                return(guild.TrainingSkills);
            }
        }
        public TempleEditViewModel Update(TempleEditViewModel Temple)
        {
            Temple _Temple = TempleRepo.Update(Temple.toModel());

            if (Temple.TempleImages != null && Temple.TempleImages.Count() > 0)
            {
                var toAdd = Temple.TempleImages.Where(i => i.ID == 0);
                foreach (var image in toAdd)
                {
                    TempleImageRepo.Add(image.toModel());
                }

                var toUpdate = Temple.TempleImages.Where(i => i.ID > 0);
                foreach (var image in toUpdate)
                {
                    TempleImageRepo.Update(image.toModel());
                }

                int[] ids      = Temple.TempleImages.Select(x => x.ID).ToArray();
                var   toDelete = TempleImageRepo.GetFilter(i => !ids.Contains(i.ID) && i.TempleID == Temple.ID);
                foreach (var image in toDelete)
                {
                    TempleImageRepo.Remove(image);
                }
            }
            unitOfWork.commit();
            return(_Temple.toEditViewModel());
        }
        private void DonationMsgBox_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            int amount = 0;

            if (int.TryParse(input, out amount))
            {
                if (playerEntity.GetGoldAmount() > amount)
                {
                    // Deduct gold, and apply blessing if member
                    playerEntity.DeductGoldAmount(amount);
                    int factionId = (int)Temple.GetDivine(buildingFactionId);

                    // Change reputation
                    int rep = Math.Abs(playerEntity.FactionData.GetReputation(factionId));
                    if (UnityEngine.Random.Range(1, 101) <= (2 * amount / rep + 1))
                    {
                        playerEntity.FactionData.ChangeReputation(factionId, 1); // Does not propagate in classic
                    }
                    // Show thanks message
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                    messageBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(DonationThanksId), this);
                    messageBox.ClickAnywhereToClose = true;
                    messageBox.Show();
                }
                else
                {
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                    messageBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(TooGenerousId), this);
                    messageBox.ClickAnywhereToClose = true;
                    messageBox.Show();
                }
            }
        }
 public void SetTemple(Temple newTemple)
 {
     temple = newTemple;
     templeName.GetComponent <TextMesh>().text       = temple.name.ToString();
     cost.GetComponent <TextMesh>().text             = temple.cost.ToString();
     templeName.GetComponent <TextMesh>().text       = temple.name.ToString();
     portrait.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Temples/Temple of " + temple.portrait);
     description.GetComponent <TextMesh>().text      = temple.description;
 }
Example #7
0
    public Temple DeepCopy()
    {
        Temple newTemple = new Temple(name, cost, description, faction);

        newTemple.portrait = portrait;
        newTemple.faction  = faction;
        newTemple.unit     = unit.DeepCopy();
        return(newTemple);
    }
Example #8
0
    void Start()
    {
        theTemple = GameObject.FindObjectOfType<Temple>();
        MessageKit.addObserver(GameEventTypes.DayEnded, dayEnded);

        MessageKit.addObserver(GameEventTypes.LightningStopped, disaster1Stopped);
        MessageKit.addObserver(GameEventTypes.EarthQuakeStopped, disaster2Stopped);
		MessageKit.addObserver(GameEventTypes.VolcanoStopped, disaster3Stopped);

		MessageKit.addObserver(GameEventTypes.GameStarting, dayEnded);
    }
Example #9
0
	public void DispatchToTheTemple(Temple temple, Vector2 templePos)
    {
        for(int i = 0; i < queueSize; ++i)
        {
            if (peons[i] != null)
            {
				peons [i].Sacrifice (temple, templePos);

				FreeSlot (i);
            }
        }
    }
Example #10
0
        /// <summary>
        /// 获取模板列表
        /// </summary>
        /// <returns></returns>
        public static PagResults <Temple> GetList(int typeid = 0, int start = 0, int limit = 0)
        {
            var result = new PagResults <Temple>();

            result.Results = new List <Temple>();
            string wheresql = typeid == 0 ? string.Empty : string.Format(" where TypeId={0} ", typeid);
            string limitsql = limit != 0 ? " LIMIT ?start,?limit" : string.Empty;
            var    cmdText  = @"select * from Temple " + wheresql + limitsql;
            List <MySqlParameter> parameters = new List <MySqlParameter>();

            if (!string.IsNullOrEmpty(limitsql))
            {
                parameters.Add(new MySqlParameter("?start", start));
                parameters.Add(new MySqlParameter("?limit", limit));
            }
            try
            {
                using (var conn = Utility.ObtainConn(Utility._gameDbConn))
                {
                    MySqlDataReader reader = MySqlHelper.ExecuteReader(conn, CommandType.Text, cmdText, parameters.ToArray());
                    while (reader.Read())
                    {
                        Temple temple = new Temple();
                        temple.Id      = reader.GetInt32(0);
                        temple.Name    = reader["Name"].ToString();
                        temple.LogoUrl = reader["LogoUrl"].ToString();
                        temple.TypeId  = (int)reader["TypeId"];

                        result.Results.Add(temple);
                    }

                    //一个函数有两次连接数据库 先把连接断开 然后重连
                    conn.Close();
                    conn.Dispose();
                    conn.Open();

                    cmdText = "select count(*) from Temple " + wheresql;
                    reader  = MySqlHelper.ExecuteReader(conn, CommandType.Text, cmdText);
                    if (reader.HasRows)
                    {
                        if (reader.Read())
                        {
                            result.TotalCount = reader.GetInt32(0);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw;
            }
            return(result);
        }
Example #11
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        //DontDestroyOnLoad(gameObject);
    }
Example #12
0
 void Start()
 {
     mapEngine       = FindObjectOfType <MapEngine>();
     temple          = FindObjectOfType <Temple>();
     clone           = GameObject.Find("Clone");
     player          = GameObject.Find("Player");
     canMove         = false;
     seenPlayer      = false;
     radius1         = 100;
     radius2         = 30;
     maxCount        = 30;
     counter         = maxCount;
     currentVelocity = clone.transform.GetComponent <Rigidbody2D>().velocity;
 }
Example #13
0
        public ResponseDto <bool> Delete([FromBody] Temple temple)
        {
            ResponseDto <bool> response = new ResponseDto <bool>(_commonResource);

            try
            {
                _templeService.Delete(temple);
                return(response);
            }
            catch (Exception ex)
            {
                return(response.HandleDeleteException(response, ex));
            }
        }
Example #14
0
        public ResponseDto <Temple> Save([FromBody] Temple temple)
        {
            ResponseDto <Temple> response = new ResponseDto <Temple>(_commonResource);

            try
            {
                response.Data = _templeService.Save(temple);
                return(response);
            }
            catch
            {
                return(response.HandleException(response));
            }
        }
Example #15
0
        public static TempleViewModel toViewModel(this Temple model)
        {
            return(new TempleViewModel()
            {
                ID = model.ID,
                Name = model.Name,
                Description = model.Description,
                Address = model.Address,
                TicketPrice = model.TicketPrice,
                SectionName = model.Section?.Name

                              //TempleImages = model.TempleImages
            });
        }
Example #16
0
        public TempleViewModel GetByID(int id)
        {
            Temple _Temple         = TempleRepo.GetByID(id);
            var    TempleViewModel = _Temple?.toViewModel();

            if (_Temple != null)
            {
                TempleViewModel.SectionName = _Temple?.Section.Name;
                TempleViewModel.TempleImages
                    = _Temple?.TempleImages
                      ?.Select(i => i.toViewModel());
            }
            return(TempleViewModel);
        }
Example #17
0
    public void LoadTemple()
    {
        //print("Temple Loading");
        if (currentNode.GetComponent <Node>().temple != null)
        {
            Temple     temple          = currentNode.GetComponent <Node>().temple;
            GameObject templeSpace     = Tools.GetChildNamed(locationMenu, "Temple Space");
            GameObject titleText       = Tools.GetChildNamed(templeSpace, "Temple Title Text");
            GameObject templeSprite    = Tools.GetChildNamed(templeSpace, "Temple Sprite");
            GameObject descriptionText = Tools.GetChildNamed(templeSpace, "Temple Description Text");

            titleText.GetComponent <TextMesh>().text            = temple.name.ToString();
            templeSprite.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Temples/Temple of " + temple.portrait);
            descriptionText.GetComponent <TextMesh>().text      = temple.description;
        }
    }
Example #18
0
    public void MakeTempleBlueprints(GameObject player)
    {
        Faction faction         = player.GetComponent <Player>().faction;
        Temple  armamentsTemple = new Temple(TempleName.Armaments, 30, "Decrease unit\ncost by 20%", player.GetComponent <Player>().faction);

        player.GetComponent <Player>().templeBlueprints.Add(TempleName.Armaments, armamentsTemple);
        Temple traditionTemple = new Temple(TempleName.Tradition, 30, "Decrease ritual\ncost at this node", player.GetComponent <Player>().faction);

        player.GetComponent <Player>().templeBlueprints.Add(TempleName.Tradition, traditionTemple);
        Temple protectionTemple = new Temple(TempleName.Protection, 30, "Build a powerful\ndefensive building", player.GetComponent <Player>().faction);

        player.GetComponent <Player>().templeBlueprints.Add(TempleName.Protection, protectionTemple);
        Temple originTemple = new Temple(TempleName.Origin, 50, "Allow creation\nof Prophets", player.GetComponent <Player>().faction);

        player.GetComponent <Player>().templeBlueprints.Add(TempleName.Origin, originTemple);
    }
Example #19
0
    public override void VisitBuilding(int a, int b)
    {
        base.VisitBuilding(a, b);

        Temple t = Origin.GetComponent <Temple>();
        House  h = world.Map.GetBuildingAt(a, b).GetComponent <House>();

        if (h == null)
        {
            return;
        }

        foreach (string god in t.gods)
        {
            h.SetFaith(god, 6);
        }
    }
Example #20
0
        public TempleEditViewModel Add(TempleEditViewModel Temple)
        {
            Temple _Temple = TempleRepo.Add(Temple.toModel());

            unitOfWork.commit();
            if (Temple.TempleImages != null && Temple.TempleImages.Count() > 0)
            {
                foreach (var image in Temple.TempleImages)
                {
                    image.TempleID = _Temple.ID;
                    TempleImageRepo.Add(image.toModel());
                }
            }
            unitOfWork.commit();

            return(_Temple.toEditViewModel());
        }
Example #21
0
 public void increaseIncome(int val)
 {
     if (GetComponent <Farm>() != null)
     {
         Farm temp = GetComponent <Farm>();
         temp.Increase(val * IncreaseMultiplyer);
     }
     else if (GetComponent <Lumberjack>() != null)
     {
         Lumberjack temp = GetComponent <Lumberjack>();
         temp.Increase(val * IncreaseMultiplyer);
     }
     else if (GetComponent <Temple>() != null)
     {
         Temple temp = GetComponent <Temple>();
         temp.Increase(val * IncreaseMultiplyer);
     }
 }
Example #22
0
    void MakeTemple(Faction faction)
    {
        Temple armamentsTemple = new Temple(TempleName.Armaments, 30, "Decrease unit\ncost by 20%", currentFaction);

        templeBuySpaces[0].GetComponent <TempleShopSpace>().SetTemple(armamentsTemple);

        Temple traditionTemple = new Temple(TempleName.Tradition, 30, "Decrease ritual\ncost at this node", currentFaction);

        templeBuySpaces[1].GetComponent <TempleShopSpace>().SetTemple(traditionTemple);

        Temple protectionTemple = new Temple(TempleName.Protection, 30, "Build a powerful\ndefensive building", currentFaction);

        templeBuySpaces[2].GetComponent <TempleShopSpace>().SetTemple(protectionTemple);

        Temple originTemple = new Temple(TempleName.Origin, 50, "Allow creation\nof Prophets", currentFaction);

        templeBuySpaces[3].GetComponent <TempleShopSpace>().SetTemple(originTemple);
    }
Example #23
0
        /// <summary>
        /// Initializes all buildings that belongs to this town.
        /// </summary>
        /// <returns>Array of buildings for the building tree.</returns>
        public Building[] InitializeTownBuildings()
        {
            Building[] buildings = new Building[12];

            buildings[0]  = new TownHall();
            buildings[1]  = new Pallisade();
            buildings[2]  = new Temple();
            buildings[3]  = new DragonTower();
            buildings[4]  = new TrollCave();
            buildings[5]  = new Marketplace();
            buildings[6]  = new BeastRidersGuild();
            buildings[7]  = new CernianCamp();
            buildings[8]  = new TrainingCamp();
            buildings[9]  = new MageTower();
            buildings[10] = new WarriorsCamp();
            buildings[11] = new Workshop();
            return(buildings);
        }
Example #24
0
        /// <summary>
        /// 新增模板列表
        /// </summary>
        /// <param name="temple"></param>
        /// <returns></returns>
        public static bool AddTemple(Temple temple)
        {
            var cmdText    = @"insert into Temple (Name,LogoUrl,TypeId) values(?Name,?LogoUrl,?TypeId)";
            var parameters = new List <MySqlParameter>();

            parameters.Add(new MySqlParameter("?Name", temple.Name));
            parameters.Add(new MySqlParameter("?LogoUrl", temple.LogoUrl));
            parameters.Add(new MySqlParameter("?TypeId", temple.TypeId));
            try
            {
                return
                    (MySqlHelper.ExecuteNonQuery(Utility._gameDbConn, CommandType.Text, cmdText, parameters.ToArray()) >
                     0);
            }
            catch (System.Exception ex)
            {
                throw;
            }
        }
Example #25
0
        public static TempleEditViewModel toEditViewModel(this Temple model)
        {
            return(new TempleEditViewModel()
            {
                ID = model.ID,
                Name = model.Name,
                Description = model.Description,
                Address = model.Address,
                TicketPrice = model.TicketPrice,
                SectionName = model.Section?.Name,
                SectionID = model.SectionID,


                CreateBy = model.CreateBy,
                CreateDate = model.CreateDate,
                UpdateBy = model.UpdateBy,
                UpdateDate = model.UpdateDate
            });
        }
Example #26
0
 void Start()
 {
     for (int i = 0; i < templesGO.Length; i++)
     {
         Temple thisTemple = templesGO[i].GetComponent <Temple>();
         // If i = id de alguna pregunta/respuesta que hay que decidir mañana
         for (int j = 0; j < templesQuestionAnswerIds.Length; j++)
         {
             if (templesQuestionAnswerIds[j] == i)   // REVER ESTO PORQUE PUEDE TENER ERROR
             {
                 thisTemple.templeQuestionAnswerId = i;
                 thisTemple.templeQuestion         = myTestSystem.questions[i];
                 thisTemple.templeFirstAnswer      = myTestSystem.firstAnswers[i];
                 thisTemple.templeSecondAnswer     = myTestSystem.secondAnswers[i];
             }
         }
         thisTemple.myPersonalitySystem = myPersonalitySystem;
         thisTemple.myTestSystem        = myTestSystem;
     }
 }
Example #27
0
    void CreateTemple()
    {
        //Create the temple and place it in the world
        Temple prefab = (Temple)Instantiate(Resources.Load(("Prefabs/Temple"), typeof(Temple)));

        prefab.transform.parent   = buildingGroup.transform;
        prefab.transform.position = buildingGroup.transform.position;
        prefab.SetClan(clan);


        //To get the correct color for the temple
        string color = "";

        for (int i = 1; i < clan.Length; i++)
        {
            if (char.IsUpper(clan[i]))
            {
                color = clan.Substring(0, i - 1);
                break;
            }
        }

        foreach (Transform child in prefab.transform)
        {
            child.renderer.material.color = BlackBoard.Instance.GetColorForObject(color);
            AstarPath.active.UpdateGraphs(child.collider.bounds);
        }


        //Create a dictionary and save it to the blackboard
        Dictionary <string, WorkingMemoryValue> templeInfo = new Dictionary <string, WorkingMemoryValue>();

        templeInfo.Add("Type", new WorkingMemoryValue("Temple"));
        templeInfo.Add("Position", new WorkingMemoryValue(transform.position));
        templeInfo.Add("Length", new WorkingMemoryValue(3.0f));
        templeInfo.Add("Health", new WorkingMemoryValue(1000.0f));
        templeInfo.Add("Floors", new WorkingMemoryValue(1));
        BlackBoard.Instance.SetFact(clan, "Buildings", new WorkingMemoryValue(templeInfo));
        Debug.Log("Nu är templet byggt");
    }
Example #28
0
        /// <summary>
        /// 更新模板列表
        /// </summary>
        /// <param name="temple"></param>
        /// <returns></returns>
        public static bool UpdateTemple(Temple temple)
        {
            if (temple.Id == 0)
            {
                return(false);
            }
            var cmdText    = @"update Temple set Name=?Name,LogoUrl=?LogoUrl,TypeId=?TypeId where Id=?Id;";
            var parameters = new List <MySqlParameter>();

            parameters.Add(new MySqlParameter("?Name", temple.Name));
            parameters.Add(new MySqlParameter("?LogoUrl", temple.LogoUrl));
            parameters.Add(new MySqlParameter("?TypeId", temple.TypeId));
            parameters.Add(new MySqlParameter("?Id", temple.Id));
            try
            {
                return
                    (MySqlHelper.ExecuteNonQuery(Utility._gameDbConn, CommandType.Text, cmdText, parameters.ToArray()) >
                     0);
            }
            catch (System.Exception ex)
            {
                throw;
            }
        }
Example #29
0
	// Use this for initialization
	void Start ()
	{
	    temple = FindObjectOfType<Temple>();
	
	}
 public override string GodDesc()
 {
     return(Temple.GetDeityDesc((Temple.Divines)parent.buildingFactionId));
 }
 public override string God()
 {
     return(Temple.GetDivine(parent.buildingFactionId).ToString());
 }
Example #32
0
        internal static void CityProduction(City city)
        {
            if (city == null || city.Size == 0 || city.Tile == null)
            {
                return;
            }

            Player      player     = Game.GetPlayer(city.Owner);
            IProduction production = null;

            // Create 2 defensive units per city
            if (player.HasAdvance <LaborUnion>())
            {
                if (city.Tile.Units.Count(x => x is MechInf) < 2)
                {
                    production = new MechInf();
                }
            }
            else if (player.HasAdvance <Conscription>())
            {
                if (city.Tile.Units.Count(x => x is Riflemen) < 2)
                {
                    production = new Riflemen();
                }
            }
            else if (player.HasAdvance <Gunpowder>())
            {
                if (city.Tile.Units.Count(x => x is Musketeers) < 2)
                {
                    production = new Musketeers();
                }
            }
            else if (player.HasAdvance <BronzeWorking>())
            {
                if (city.Tile.Units.Count(x => x is Phalanx) < 2)
                {
                    production = new Phalanx();
                }
            }
            else
            {
                if (city.Tile.Units.Count(x => x is Militia) < 2)
                {
                    production = new Militia();
                }
            }

            // Create city improvements
            if (production == null)
            {
                if (!city.HasBuilding <Barracks>())
                {
                    production = new Barracks();
                }
                else if (player.HasAdvance <Pottery>() && !city.HasBuilding <Granary>())
                {
                    production = new Granary();
                }
                else if (player.HasAdvance <CeremonialBurial>() && !city.HasBuilding <Temple>())
                {
                    production = new Temple();
                }
                else if (player.HasAdvance <Masonry>() && !city.HasBuilding <CityWalls>())
                {
                    production = new CityWalls();
                }
            }

            // Create Settlers
            if (production == null)
            {
                if (city.Size > 3 && !city.Units.Any(x => x is Settlers) && player.Cities.Length < 10)
                {
                    production = new Settlers();
                }
            }

            // Create some other unit
            if (production == null)
            {
                if (city.Units.Length < 4)
                {
                    if (player.Government is Republic || player.Government is Democratic)
                    {
                        if (player.HasAdvance <Writing>())
                        {
                            production = new Diplomat();
                        }
                    }
                    else
                    {
                        if (player.HasAdvance <Automobile>())
                        {
                            production = new Armor();
                        }
                        else if (player.HasAdvance <Metallurgy>())
                        {
                            production = new Cannon();
                        }
                        else if (player.HasAdvance <Chivalry>())
                        {
                            production = new Knights();
                        }
                        else if (player.HasAdvance <TheWheel>())
                        {
                            production = new Chariot();
                        }
                        else if (player.HasAdvance <HorsebackRiding>())
                        {
                            production = new Cavalry();
                        }
                        else if (player.HasAdvance <IronWorking>())
                        {
                            production = new Legion();
                        }
                    }
                }
                else
                {
                    if (player.HasAdvance <Trade>())
                    {
                        production = new Caravan();
                    }
                }
            }

            // Set random production
            if (production == null)
            {
                IProduction[] items = city.AvailableProduction.ToArray();
                production = items[Common.Random.Next(items.Length)];
            }

            city.SetProduction(production);
        }
Example #33
0
	/**
	 * Called when the script is loaded, before the game starts
	 */
	void Awake () {
		S = this;
	}
Example #34
0
	public void Sacrifice (Temple temple, Vector3 templeLocation)
	{
		targetTemple = temple;
		actionState = State.eOfferingItem;
		MoveToPoint(templeLocation);
	}
Example #35
0
	void Start()
	{
		m_cam = Camera.main.GetComponent<CameraFollowPlayer>();
		m_temple = GameObject.FindObjectOfType<Temple>();
	}
Example #36
0
 // Use this for initialization
 void Awake()
 {
     temple = FindObjectOfType <Temple>();
 }
Example #37
0
        public TempleViewModel GetByID(int id)
        {
            Temple Temple = TempleRepo.GetByID(id);

            return(Temple.toViewModel());
        }