コード例 #1
0
ファイル: RTSFactionManager.cs プロジェクト: huytd/fosproject
 public FactionItem GetFactionItemByType( FactionType type )
 {
     foreach( FactionItem item in factions )
         if( item.FactionType == type )
             return item;
     return null;
 }
コード例 #2
0
        private ShieldBuildingInfo LoadEffectsForBuilding(Entity building)
        {
            FactionType   factionType = this.GetFactionType(building);
            List <string> list        = new List <string>();

            if (factionType == FactionType.Empire)
            {
                list.Add("effect160");
                list.Add("effect39");
                list.Add("effect157");
                list.Add("effect159");
                list.Add("effect158");
            }
            else
            {
                list.Add("effect161");
                list.Add("effect166");
                list.Add("effect165");
                list.Add("effect164");
                list.Add("effect167");
            }
            list.Add("fx_debris_6x6");
            List <string> list2 = new List <string>();
            int           i     = 0;
            int           count = list.Count;

            while (i < count)
            {
                list2.Add(this.GetAssetType(list[i]).AssetName);
                i++;
            }
            ShieldBuildingInfo shieldBuildingInfo = new ShieldBuildingInfo(building, list);
            List <object>      list3 = new List <object>();
            List <AssetHandle> list4 = new List <AssetHandle>();
            int j      = 0;
            int count2 = list.Count;

            while (j < count2)
            {
                list3.Add(new KeyValuePair <string, ShieldBuildingInfo>(list[j], shieldBuildingInfo));
                list4.Add(AssetHandle.Invalid);
                j++;
            }
            Service.Get <AssetManager>().MultiLoad(list4, list2, new AssetSuccessDelegate(this.OnEffectLoaded), null, list3, new AssetsCompleteDelegate(this.OnEffectsComplete), shieldBuildingInfo);
            shieldBuildingInfo.AssetHandles = list4;
            this.buildings.Add(building, shieldBuildingInfo);
            return(shieldBuildingInfo);
        }
コード例 #3
0
        public void TryRetroactiveAchievements()
        {
            Dictionary <string, string> .KeyCollection keyCollection = null;
            FactionType faction = Service.CurrentPlayer.Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    keyCollection = this.rebelBuildingLevelAchievements.Keys;
                }
            }
            else
            {
                keyCollection = this.empireBuildingLevelAchievements.Keys;
            }
            if (keyCollection != null)
            {
                string          baseUId = string.Empty;
                string          text    = string.Empty;
                List <Building> list    = new List <Building>();
                foreach (string current in keyCollection)
                {
                    int indexOfFirstNumericCharacter = StringUtils.GetIndexOfFirstNumericCharacter(current);
                    if (indexOfFirstNumericCharacter >= 0)
                    {
                        int num = Convert.ToInt32(current.Substring(indexOfFirstNumericCharacter));
                        baseUId = current.Substring(0, indexOfFirstNumericCharacter);
                        list.Clear();
                        Service.CurrentPlayer.Map.GetAllBuildingsWithBaseUid(baseUId, list);
                        for (int i = 0; i < list.Count; i++)
                        {
                            text = list[i].Uid;
                            indexOfFirstNumericCharacter = StringUtils.GetIndexOfFirstNumericCharacter(text);
                            if (indexOfFirstNumericCharacter >= 0 && num <= Convert.ToInt32(text.Substring(indexOfFirstNumericCharacter)))
                            {
                                this.TryUnlockAchievementById(AchievementType.BuildingLevel, current);
                            }
                        }
                    }
                }
            }
            this.TryUnlockAchievementByValue(AchievementType.PveStars, Service.CurrentPlayer.CampaignProgress.GetTotalCampaignStarsEarnedInAllCampaigns());
            this.TryUnlockAchievementByValue(AchievementType.LootCreditsPvp, Service.CurrentPlayer.BattleHistory.GetTotalPvpCreditsLooted());
            this.TryUnlockAchievementByValue(AchievementType.LootAlloyPvp, Service.CurrentPlayer.BattleHistory.GetTotalPvpMaterialLooted());
            this.TryUnlockAchievementByValue(AchievementType.LootContrabandPvp, Service.CurrentPlayer.BattleHistory.GetTotalPvpContrabandLooted());
            this.TryUnlockAchievementByValue(AchievementType.PvpWon, Service.CurrentPlayer.BattleHistory.GetTotalPvpWins());
        }
コード例 #4
0
ファイル: Actor.cs プロジェクト: bigstupidx/gameFingerStorm
    public Actor(int actorId, RaceType raceType, ActorType type, FactionType faction)
    {
        this.ActorId         = actorId;
        this.ActorType       = type;
        this.FactionType     = faction;
        this.RaceType        = raceType;
        this.ActorArmor      = ActorsConfig.GetActorArmor(this.RaceType, this.ActorType);
        this.ActorAttack     = ActorsConfig.GetActorAttack(this.RaceType, this.ActorType);
        this.AttackAirForce  = ActorsConfig.GetAttackAirForce(this.RaceType, this.ActorType);
        this.IsAirForce      = ActorsConfig.GetIsAirForce(this.RaceType, this.ActorType);
        this.TotalHp         = ActorsConfig.GetHp(this.RaceType, this.ActorType);
        this.ActorLevel      = ActorsConfig.GetActorLevel(this.RaceType, this.ActorType);
        this.SpellDictionary = ActorsConfig.GetSpellDictionary(this.RaceType, this.ActorType);

        this.CurrentHp = this.TotalHp;
    }
コード例 #5
0
        public ResourceKey GetIcon(FactionType type, bool getLargeIcon = false)
        {
            ResourceKey result;

            if (getLargeIcon && this.iconLargeLookup.TryGetValue(type, out result))
            {
                return(result);
            }

            if (this.iconSmallLookup.TryGetValue(type, out result))
            {
                return(result);
            }

            return(ResourceKey.Invalid);
        }
コード例 #6
0
        public FactionFlipScreen() : base("gui_faction_second")
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;

            if (currentPlayer.NumIdentities == 1)
            {
                int num = currentPlayer.Map.FindHighestHqLevel();
                this.locked = (num < GameConstants.FACTION_FLIPPING_UNLOCK_LEVEL);
            }
            this.currentFaction  = currentPlayer.Faction;
            this.oppositeFaction = ((this.currentFaction != FactionType.Empire) ? FactionType.Empire : FactionType.Rebel);
            if (!this.locked && currentPlayer.NumIdentities > 1)
            {
                Service.PlayerIdentityController.GetOtherPlayerIdentity(new PlayerIdentityController.GetOtherPlayerIdentityCallback(this.OnGetOtherPlayerIdentity));
            }
        }
コード例 #7
0
        public RaceProvider ByFaction(FactionType faction)
        {
            var dataId = GameModules.Instance.LogicCore.FactionProvider.Get(faction);

            if (dataId == GameDataId.Invalid)
            {
                this.FilteredList.Clear();
                return(this);
            }

            IList <RuntimeRaceData> cache = this.FilteredList.Where(x => x.Factions.Contains(dataId)).ToList();

            this.FilteredList.Clear();
            this.FilteredList.AddRange(cache);
            return(this);
        }
コード例 #8
0
        protected override void InitService()
        {
            FactionType          faction = Service.CurrentPlayer.Faction;
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (SpecialAttackTypeVO current in staticDataController.GetAll <SpecialAttackTypeVO>())
            {
                if (current.PlayerFacing && current.Faction == faction)
                {
                    if (current.DPS > this.MaxSpecialAttackDps)
                    {
                        this.MaxSpecialAttackDps = current.DPS;
                    }
                }
            }
            Service.StarshipUpgradeCatalog = this;
        }
コード例 #9
0
    public GameObject CreateNewBuilding(BuildingType buildingType, FactionType factionType, Vector3 pos)
    {
        GameObject buildingObj = (GameObject)Object.Instantiate(Resources.Load("GameScene/Building"));

        buildingObj.name = "Building";
        buildingObj.transform.localScale = new Vector3(1, 1, 1);
        buildingObj.transform.position   = pos;
        BuildingController buildingCtrl = buildingObj.GetComponent <BuildingController>();

        buildingCtrl.Building = new Building(this.GenerateNewBuildingId(), buildingType, factionType);
        if (buildingCtrl.Building.IsMainCity)
        {
            this.baseBuildingDictionary.Add(factionType, buildingObj);
        }
        this.allBuildingsDictionary.Add(buildingCtrl.Building.BuildingId, buildingObj);
        return(buildingObj);
    }
コード例 #10
0
        public FactionItem GetFactionItemByType(FactionType type)
        {
            if (type as VBFactionType == null)
            {
                return(null);
            }

            foreach (FactionItem item in factions)
            {
                if (item.FactionType == type)
                {
                    return(item);
                }
            }

            return(null);
        }
コード例 #11
0
        public static string GetIconNameFromFactionType(FactionType factionType)
        {
            string result = "icoNeutral";

            if (factionType != FactionType.Empire)
            {
                if (factionType == FactionType.Rebel)
                {
                    result = "icoRebel";
                }
            }
            else
            {
                result = "IcoEmpire";
            }
            return(result);
        }
コード例 #12
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id == EventId.ScreenClosing)
     {
         ChooseFactionScreen chooseFactionScreen = cookie as ChooseFactionScreen;
         if (chooseFactionScreen != null)
         {
             FactionType factionType = Service.Get <CurrentPlayer>().Faction;
             if (factionType == this.faction)
             {
                 this.RemoveListeners();
                 this.parent.SatisfyTrigger(this);
             }
         }
     }
     return(EatResponse.NotEaten);
 }
コード例 #13
0
        public override void OnEnter()
        {
            PartyModel model = AmbitionApp.GetModel <PartyModel>();

            IncidentConfig[]  configs = Resources.LoadAll <IncidentConfig>(Filepath.INCIDENTS_PARTY_INTRO);
            List <IncidentVO> results = new List <IncidentVO>();
            IncidentVO        incident;
            FactionType       faction = model.Party.Faction;
            bool foundFaction         = false;
            bool found;

            foreach (IncidentConfig config in configs)
            {
                incident = config?.GetIncident();
                if (incident != null)
                {
                    if (!foundFaction)
                    {
                        if (incident.Factions == null || incident.Factions.Length == 0)
                        {
                            results.Add(incident);
                        }
                        else
                        {
                            found = Array.IndexOf(incident.Factions, faction) >= 0;
                            if (found && faction == FactionType.None)
                            {
                                results.Add(incident);
                            }
                            else
                            {
                                foundFaction = true;
                                results.Clear();
                                results.Add(incident);
                            }
                        }
                    }
                    else if (incident.Factions != null && Array.IndexOf(incident.Factions, faction) >= 0)
                    {
                        results.Add(incident);
                    }
                }
            }
            incident = Util.RNG.TakeRandom(results);
            AmbitionApp.Story.Schedule(incident);
        }
コード例 #14
0
        public static SpawnPoint AKGetFreeRandomSpawnPoint(FactionType faction)
        {
            foreach (SpawnPoint sp in instances)
            {
                //if (sp.faction != faction)
                //    continue;

                bool busy = false;
                {
                    Bounds volume = new Bounds(sp.Position);
                    volume.Expand(new Vec3(1, 1, 2));

                    Body[] result = PhysicsWorld.Instance.VolumeCast(volume,
                                                                     (int)ContactGroup.CastOnlyContact);

                    foreach (Body body in result)
                    {
                        if (body.Static)
                        {
                            continue;
                        }

                        foreach (Shape shape in body.Shapes)
                        {
                            if (PhysicsWorld.Instance.IsContactGroupsContactable(shape.ContactGroup,
                                                                                 (int)ContactGroup.Dynamic))
                            {
                                busy = true;
                                break;
                            }
                        }
                        if (busy)
                        {
                            break;
                        }
                    }
                }

                if (!busy)
                {
                    return(sp);
                }
            }

            return(null);
        }
コード例 #15
0
        private void PlaceSquadFlag(FactionType faction)
        {
            string assetName;

            if (faction == FactionType.Empire)
            {
                assetName = GameConstants.SQUAD_TROOP_DEPLOY_FLAG_EMPIRE_ASSET;
            }
            else
            {
                assetName = GameConstants.SQUAD_TROOP_DEPLOY_FLAG_REBEL_ASSET;
            }
            IntPosition position = new IntPosition(this.spawnPosition.x - 1, this.spawnPosition.z);
            Vector3     worldPos = Units.BoardToWorldVec(position);

            Service.Get <FXManager>().CreateFXAtPosition(assetName, worldPos, Quaternion.AngleAxis(-90f, Vector3.up));
        }
コード例 #16
0
        private bool CheckStrategy(IEnumerable <FactionType> selectList, FactionType select, out FactionType strategy)
        {
            strategy = FactionType.A;

            if (selectList.Count() < Consts.CombineMax &&
                _strategyTable.ContainsKey(select))
            {
                var list = _strategyTable[select].Except(selectList);
                if (list.Count() > 0)
                {
                    strategy = RandomFaction(list);
                    return(true);
                }
            }

            return(false);
        }
コード例 #17
0
        private void InitLabels()
        {
            this.mainGroup         = base.GetElement <UXElement>("DefaultContainer");
            this.mainGroup.Visible = true;
            UXLabel element = base.GetElement <UXLabel>("LabelSettingsTitle");

            element.Text = this.lang.Get("SETTINGS_TITLE", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnMusic");
            element.Text = this.lang.Get("SETTINGS_MUSIC", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnSoundEffects");
            element.Text = this.lang.Get("SETTINGS_SFX", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnLanguage");
            element.Text = this.lang.GetDisplayLanguage(this.lang.Locale);
            this.SetFacebookButtonLabel(Service.ISocialDataController.IsLoggedIn);
            this.SetGoogleButtonLabel(GameServicesManager.IsUserAuthenticated());
            element      = base.GetElement <UXLabel>("LabelBtnAbout");
            element.Text = this.lang.Get("SETTINGS_ABOUT", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnHelp");
            element.Text = this.lang.Get("SETTINGS_HELP", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnPrivacyPolicy");
            element.Text = this.lang.Get("SETTINGS_PRIVACY", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnTOS");
            element.Text = this.lang.Get("SETTINGS_TOS", new object[0]);
            if (GameConstants.FORUMS_ENABLED)
            {
                element      = base.GetElement <UXLabel>("LabelBtnForums");
                element.Text = this.lang.Get("SETTINGS_FORUMS", new object[0]);
            }
            element      = base.GetElement <UXLabel>("LabelFBIncentiveGoogle");
            element.Text = this.lang.Get("CONNECT_FB_SETTINGS_DESC", new object[0]);
            element      = base.GetElement <UXLabel>("LabelBtnFactionSwap");
            FactionType faction = Service.CurrentPlayer.Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    element.Text = this.lang.Get("FACTION_FLIP_PLAY_EMPIRE", new object[0]);
                }
            }
            else
            {
                element.Text = this.lang.Get("FACTION_FLIP_PLAY_REBEL", new object[0]);
            }
        }
コード例 #18
0
        protected void AnimateStars(int stars)
        {
            for (int i = 1; i <= stars; i++)
            {
                FactionType factionType = this.faction;
                string      text;
                if (factionType != FactionType.Empire)
                {
                    if (factionType != FactionType.Rebel)
                    {
                        text = (this.isNonAttackerReplayView ? (this.ReplayPrefix + "StarAnim{0}") : "StarAnim{0}");
                    }
                    else
                    {
                        text = (this.isNonAttackerReplayView ? (this.ReplayPrefix + "StarAnim{0}_Rebel") : "StarAnim{0}_Rebel");
                    }
                }
                else
                {
                    text = (this.isNonAttackerReplayView ? (this.ReplayPrefix + "StarAnim{0}_Empire") : "StarAnim{0}_Empire");
                }
                UXElement element = base.GetElement <UXElement>(string.Format(text, new object[]
                {
                    i
                }));
                Animator component = element.Root.GetComponent <Animator>();
                if (component == null)
                {
                    Service.Get <StaRTSLogger>().WarnFormat("Unable to play end star anim #{0}", new object[]
                    {
                        i
                    });
                }
                else
                {
                    this.viewAnimators.Add(component);
                    KeyValuePair <int, Animator> keyValuePair = new KeyValuePair <int, Animator>(i, component);
                    uint item = Service.Get <ViewTimerManager>().CreateViewTimer((float)(i - 1) * 1f, false, new TimerDelegate(this.OnAnimateStarTimer), keyValuePair);
                    this.viewTimers.Add(item);
                }
            }
            uint item2 = Service.Get <ViewTimerManager>().CreateViewTimer((float)(stars - 1) * 1f + 0.35f, false, new TimerDelegate(this.OnAllStarsComplete), null);

            this.viewTimers.Add(item2);
        }
コード例 #19
0
        //public static int AKGetSpawnIdBySpawnIdwithFacton(SpawnPoint spawnpoint, FactionType faction)
        //{
        //    foreach (SpawnPoint sp in instances)
        //    {
        //        if (sp.faction != faction)
        //            continue;

        //        if (sp.SpawnID != spawnpoint.SpawnID)
        //        {
        //            continue;
        //        }

        //        return (int)spawnpoint.SpawnID;

        //    }
        //    return 0;
        //}

        public static SpawnPoint AKGetSpawnIdBySpawnIdwithFaction(uint spawnid, FactionType faction)
        {
            foreach (SpawnPoint sp in instances)
            {
                if (sp.faction != faction)
                {
                    continue;
                }

                if (sp.SpawnID != (SpawnId)spawnid)
                {
                    continue;
                }

                return(sp);
            }
            return(null);
        }
コード例 #20
0
        public static SpawnId AKGetSpawnIdBySpawnIdwithFacton(SpawnPoint spawnpoint, FactionType faction)
        {
            foreach (SpawnPoint sp in instances)
            {
                if (sp.faction != faction)
                {
                    continue;
                }

                if (sp.SpawnID != spawnpoint.SpawnID)
                {
                    continue;
                }

                return(spawnpoint.SpawnID);
            }
            return(SpawnId.NONE);
        }
コード例 #21
0
        private void ShowImpactFXForBulletOwner(ProjectileView view, SmartEntity owner)
        {
            this.ShowImpactFXForView(view);
            Bullet      bullet       = view.Bullet;
            List <Buff> appliedBuffs = bullet.AppliedBuffs;
            int         num          = (appliedBuffs != null) ? appliedBuffs.Count : 0;
            FactionType ownerFaction = bullet.OwnerFaction;

            for (int i = 0; i < num; i++)
            {
                string impactAssetNameBasedOnFaction = bullet.AppliedBuffs[i].BuffType.GetImpactAssetNameBasedOnFaction(ownerFaction);
                if (!string.IsNullOrEmpty(impactAssetNameBasedOnFaction))
                {
                    this.ShowImpactFXForView(view, impactAssetNameBasedOnFaction);
                }
            }
            Service.Get <EventManager>().SendEvent(EventId.ProjectileViewImpacted, owner);
        }
コード例 #22
0
 public static Faction GetFaction(FactionType type, int size, Point spawn)
 {
     switch(type)
     {
         case FactionType.Dwarf:
             return new DwarfFaction(size, spawn);
         case FactionType.Elf:
             return new ElfFaction(size, spawn);
         case FactionType.Knight:
             return new KnightFaction(size, spawn);
         case FactionType.Orc:
             return new OrcFaction(size, spawn);
         case FactionType.Slime:
             return new SlimeFaction(size, spawn);
         default:
             throw new ArgumentException("Impossible to create Faction of type \""+type+"\"", "type");
     }
 }
コード例 #23
0
ファイル: UnitEdit.cs プロジェクト: BradZzz/EldersTale
 void Setup(string cName, string cMonik, int cLvl, int team, int mxHlth, int atk, int moveSpeed, int atkRange,
            int trnMvs, int trnAtks, string[] skills, string currentClass, UnitType uType = UnitType.Soldier, FactionType fType = FactionType.Human)
 {
     this.characterName    = cName + UnityEngine.Random.Range(0, 1).ToString();
     this.characterMoniker = cMonik;
     this.team             = team;
     this.mxHlth           = cHlth = mxHlth;
     this.atk          = atk;
     this.moveSpeed    = moveSpeed;
     this.atkRange     = atkRange;
     this.lvl          = cLvl;
     this.currentClass = currentClass;
     this.uType        = uType;
     this.fType        = fType;
     this.trnAtks      = trnAtks;
     this.trnMvs       = trnMvs;
     this.skills       = skills;
     this.turnActions  = new TurnActionsBasicUnit(trnMvs, trnAtks);
 }
コード例 #24
0
        public bool EnableFindMeButton()
        {
            bool flag = Service.Get <SquadController>().StateManager.GetCurrentSquad() != null;

            if (!this.top50Button.Enabled && this.curTab == SocialTabs.Squads && !flag)
            {
                return(false);
            }
            string selectedPlanetId = this.GetSelectedPlanetId();

            if (!this.top50Button.Enabled && selectedPlanetId != null && selectedPlanetId != Service.Get <CurrentPlayer>().PlanetId&& this.curTab == SocialTabs.Leaders)
            {
                return(false);
            }
            FactionToggle selectedFaction = this.GetSelectedFaction();
            FactionType   faction         = Service.Get <CurrentPlayer>().Faction;

            return(!this.top50Button.Enabled && (selectedFaction == FactionToggle.All || (faction == FactionType.Empire && selectedFaction == FactionToggle.Empire) || (faction == FactionType.Rebel && selectedFaction == FactionToggle.Rebel)));
        }
コード例 #25
0
        //AK 0.85 code
        private bool Done()
        {
            if (selectedSpawnPoint == null)
            {
                return(false);
            }

            if (GameNetworkServer.Instance != null)
            {
                SpawnPoint.SelectedSinglePlayerPoint = selectedSpawnPoint.sp; //iNCIN added this -- test
                GameNetworkServer.Instance.UserManagementService.ServerUser.Faction           = selectedSpawnPoint.sp.Faction.Name;
                GameNetworkServer.Instance.UserManagementService.ServerUser.DefaultSpawnPoint = selectedSpawnPoint.sp.NetworkUIN;
                GameNetworkServer.Instance.UserManagementService.ServerUser.SpawnId           = (uint)selectedSpawnPoint.sp.SpawnID;
                GameEngineApp.Instance.CreateGameWindowForMap();
            }
            else if (GameNetworkClient.Instance != null)
            {
                //string error;
                GameNetworkClient.Instance.UserManagementService.ThisUser.Faction           = selectedSpawnPoint.sp.Faction.Name;
                GameNetworkClient.Instance.UserManagementService.ThisUser.DefaultSpawnPoint = selectedSpawnPoint.sp.NetworkUIN;
                SpawnPoint.SelectedSinglePlayerPoint = selectedSpawnPoint.sp;

                GameNetworkClient.Instance.CustomMessagesService.SendToServer("SpawnInfoToServer", GameNetworkClient.Instance.UserManagementService.ThisUser.Identifier + ";" + (uint)selectedSpawnPoint.sp.SpawnID + ";" + selectedSpawnPoint.sp.Faction.Name);
                //GameNetworkClient.Instance.UserManagementService.RecieveMessage_SpawnInformationToClient(GameNetworkClient.Instance.UserManagementService.Owner.ServerConnectedNode,
                //    "spawnInfoToServer", selectedSpawnPoint.sp.NetworkUIN.ToString() + ";" + selectedSpawnPoint.sp.Faction.Name.ToString(), ref error);
                //        //GameNetworkClient.Instance.UserManagementService.RecieveMessage_SpawnInformationToServer(
                //        //GameNetworkClient.Instance.UserManagementService.ThisUser, selectedSpawnPoint.sp.NetworkUIN,
                //        //selectedSpawnPoint.sp.Faction.Name);

                //GameNetworkClient.Instance.CustomMessagesService.ReceiveMessage +=new CustomMessagesClientNetworkService.ReceiveMessageDelegate(CustomMessagesService_ReceiveMessage);
                GameEngineApp.Instance.CreateGameWindowForMap();
            }
            else
            {
                PlayerManager.ServerOrSingle_Player player = PlayerManager.Instance.ServerOrSingle_Players[0];
                FactionType playerFaction = EntityTypes.Instance.GetByName(selectedSpawnPoint.sp.Faction.Name) as FactionType;
                player.Intellect.Faction             = playerFaction;
                SpawnPoint.SelectedSinglePlayerPoint = selectedSpawnPoint.sp;
                GameEngineApp.Instance.CreateGameWindowForMap();
            }
            //GameEngineApp.Instance.CreateGameWindowForMap();
            return(true);
        }
コード例 #26
0
        private void InitIcons(string id, FactionType faction, int rating)
        {
            bool flag = Service.FactionIconUpgradeController.UseUpgradeImage(rating);

            this.squadFactionSprite.Visible  = !flag;
            this.playerFactionSprite.Visible = flag;
            if (flag)
            {
                this.playerFactionSprite.SpriteName = Service.FactionIconUpgradeController.GetIcon(faction, rating);
            }
            else if (faction == FactionType.Empire)
            {
                this.squadFactionSprite.SpriteName = "FactionEmpire";
            }
            else if (faction == FactionType.Rebel)
            {
                this.squadFactionSprite.SpriteName = "FactionRebel";
            }
        }
コード例 #27
0
 public bool InitWithTarget(int spawnBoardX, int spawnBoardZ, Vector3 spawnWorldLocation, Target target, TeamType ownerTeam, Entity attacker, HealthFragment healthFrag, ProjectileTypeVO projectileTypeVO, List <Buff> appliedBuffs, FactionType faction, GameObject gunLocator)
 {
     if (target == null)
     {
         return(false);
     }
     this.OwnerFaction = faction;
     this.AppliedBuffs = appliedBuffs;
     this.InitWithEverything(0u, spawnBoardX, spawnBoardZ, spawnWorldLocation, target.TargetEntity, target.TargetBoardX, target.TargetBoardZ, ownerTeam, attacker, healthFrag, projectileTypeVO, gunLocator);
     if (this.ProjectileType.IsBeam)
     {
         this.SetupBeam();
     }
     else
     {
         this.SetTargetWorldLocation(target.TargetWorldLocation);
     }
     return(true);
 }
コード例 #28
0
    public void CreateNewActor(FactionType factionType, RaceType raceType, ActorType actorType, Vector3 pos)
    {
        GameObject actorObj = (GameObject)Object.Instantiate(Resources.Load("GameScene/Actor"));
        int        actorId  = this.GenerateNewActorId();

        actorObj.transform.name       = "Actor_" + actorId.ToString("D3");
        actorObj.transform.localScale = new Vector3(1, 1, 1);
        actorObj.transform.position   = pos;
        ActorController actorCtrl = actorObj.GetComponent <ActorController>();
        Actor           actor     = new Actor(actorId, raceType, actorType, factionType);

        actorCtrl.TargetBuilding =
            BuildingsManager.GetInstance()
            .GetBaseBuildingOfFaction(actor.FactionType == FactionType.Blue ? FactionType.Red : FactionType.Blue);
        actorCtrl.ActorPath = ActorPathManager.GetInstance()
                              .GenerateNewPath(pos, actorCtrl.TargetBuilding.transform.position);
        actorCtrl.MyActor = actor;
        this.actorsDictionary.Add(actorId, actorObj);
    }
コード例 #29
0
        public static void Run(FactionType faction)
        {
            MapInstance map = faction == FactionType.Angel ? ServerManager.Instance.Act4ShipAngel : ServerManager.Instance.Act4ShipDemon;

            if (map == null)
            {
                return;
            }

            OpenShip();
            Observable.Timer(TimeSpan.FromMinutes(1)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHIP_MINUTES"), 4), 0));
            });
            Observable.Timer(TimeSpan.FromMinutes(2)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHIP_MINUTES"), 3), 0));
            });
            Observable.Timer(TimeSpan.FromMinutes(3)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHIP_MINUTES"), 2), 0));
            });
            Observable.Timer(TimeSpan.FromMinutes(4)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("SHIP_MINUTE"), 0));
                LockShip();
            });
            Observable.Timer(TimeSpan.FromMinutes(4) + TimeSpan.FromSeconds(30)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHIP_SECONDS"), 30), 0));
            });
            Observable.Timer(TimeSpan.FromMinutes(4) + TimeSpan.FromSeconds(50)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHIP_SECONDS"), 10), 0));
            });
            Observable.Timer(TimeSpan.FromMinutes(4) + TimeSpan.FromSeconds(55)).Subscribe(o =>
            {
                map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("SHIP_SETOFF"), 0));
                List <ClientSession> sessions = map.Sessions.Where(s => s?.Character != null).ToList();
                TeleportPlayers(sessions);
            });
        }
コード例 #30
0
        public void StartCampaignProgress()
        {
            string      uid     = string.Empty;
            FactionType faction = this.player.Faction;

            if (faction != FactionType.Rebel)
            {
                if (faction == FactionType.Empire)
                {
                    uid = GameConstants.NEW_PLAYER_INITIAL_MISSION_EMPIRE;
                }
            }
            else
            {
                uid = GameConstants.NEW_PLAYER_INITIAL_MISSION_REBEL;
            }
            CampaignMissionVO missionType = Service.StaticDataController.Get <CampaignMissionVO>(uid);

            this.UnlockMission(missionType);
        }
コード例 #31
0
    public Faction SetNewFaction(string title, FactionType type, int baseRelation)
    {
        Faction newFaction = new Faction();

        newFaction.title        = title;
        newFaction.type         = type;
        newFaction.baseRelation = baseRelation;
        newFaction.relations    = new List <int>();

        if (factions.Count > 0)
        {
            foreach (Faction faction in factions)
            {
                faction.relations.Add(newFaction.baseRelation);
                newFaction.relations.Add(faction.baseRelation);
            }
        }
        factions.Add(newFaction);
        return(newFaction);
    }
コード例 #32
0
		public static SpawnPoint AKGetFreeRandomSpawnPoint(FactionType faction)
		{
            foreach (SpawnPoint sp in instances)
            {
                //if (sp.faction != faction)
                //    continue;

                bool busy = false;
                {
                    Bounds volume = new Bounds(sp.Position);
                    volume.Expand(new Vec3(1, 1, 2));

                    Body[] result = PhysicsWorld.Instance.VolumeCast(volume,
                        (int)ContactGroup.CastOnlyContact);

                    foreach (Body body in result)
                    {
                        if (body.Static)
                            continue;

                        foreach (Shape shape in body.Shapes)
                        {
                            if (PhysicsWorld.Instance.IsContactGroupsContactable(shape.ContactGroup,
                                (int)ContactGroup.Dynamic))
                            {
                                busy = true;
                                break;
                            }
                        }
                        if (busy)
                            break;
                    }
                }

                if (!busy)
                    return sp;
            }

            return null;
		}
コード例 #33
0
 public static void modifyOpinion(FactionType faction, float change)
 {
     factionOpinion[faction] += change;
 }
コード例 #34
0
    // set tag
    void SetFaction(FactionType newFaction)
    {
        var dude = GetComponent<Dude>();
        currentType = newFaction;
        if(newFaction == FactionType.ROMAN)
        {
            dude.detectEnemyRange = 4f;
            dude.detectPlayerRange = 3f;
            dude.playerInfluenceFactor = romanPlayerInfluence;
            if(currentClone != null)
                Destroy(currentClone);

            if(romanFab != null)
            {
                currentClone = (GameObject)Instantiate(romanFab, this.transform.position, this.transform.rotation);
                currentClone.transform.parent = transform;
            }

            this.tag = "ROMAN";
            this.onDeath = AIRoman.OnDeath;
            this.onInfluence = AIRoman.OnInfluence;

        }
        else if(newFaction == FactionType.VIKING)
        {
            dude.detectEnemyRange = 10f;
            dude.detectPlayerRange = 2f;
            dude.playerInfluenceFactor = vikingPlayerInfluence;
            if(currentClone != null)
                Destroy(currentClone);

            if(vitringFab != null)
            {
                currentClone = (GameObject)Instantiate(vitringFab, this.transform.position, this.transform.rotation);
                currentClone.transform.parent = transform;
            }

            this.tag = "VITRING";
            this.onDeath = AIVitring.OnDeath;
            this.onInfluence = AIVitring.OnInfluence;
        }
        else if (newFaction == FactionType.ROBIN)
        {
            dude.detectEnemyRange = 1.5f;
            dude.detectPlayerRange = 4f;
            if(currentClone != null)
                Destroy(currentClone);

            if(robinFab != null)
            {
                currentClone = (GameObject)Instantiate(robinFab, this.transform.position, this.transform.rotation);
                currentClone.transform.parent = transform;
            }
            this.tag = "ROBIN";
            this.onDeath = AIRobin.OnDeath;
            this.onInfluence = AIRobin.OnInfluence;
        }
        else
        {
            this.tag = "PLAYER";
        }
    }
コード例 #35
0
ファイル: Dude.cs プロジェクト: RebelMoogle/GlobalGameJam2014
 bool factionsAreAmicable(FactionType attackerFaction, FactionType attackeeFaction)
 {
     if (attackeeFaction == FactionType.PLAYER) {
         return !AILibs.factionDislikesPlayer(attackerFaction);
     } else {
         // if the factions both like the player, then they are amicable
         return attackerFaction == attackeeFaction || (AILibs.factionLikesPlayer(attackerFaction) && AILibs.factionLikesPlayer(attackeeFaction));
     }
 }
コード例 #36
0
        //public static int AKGetSpawnIdBySpawnIdwithFacton(SpawnPoint spawnpoint, FactionType faction)
        //{
        //    foreach (SpawnPoint sp in instances)
        //    {
        //        if (sp.faction != faction)
        //            continue;

        //        if (sp.SpawnID != spawnpoint.SpawnID)
        //        {
        //            continue;
        //        }

        //        return (int)spawnpoint.SpawnID;

        //    }
        //    return 0;
        //}

        public static SpawnPoint AKGetSpawnIdBySpawnIdwithFaction(uint spawnid, FactionType faction)
        {
            foreach (SpawnPoint sp in instances)
            {
                if (sp.faction != faction)
                    continue;

                if (sp.SpawnID != (SpawnId)spawnid)
                {
                    continue;
                }

                return sp;
            }
            return null;
        }
コード例 #37
0
        private void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            string s = reader.ReadString();
            if (!reader.Complete())
                return;

            faction = (FactionType)EntityTypes.Instance.GetByName(s);
        }
コード例 #38
0
ファイル: Game.cs プロジェクト: Julien-Marcou/SmallWorld
        public void AddPlayer(string name, Color color, FactionType factionType, AIType aiType = AIType.None)
        {
            if (Players.Count == MaxPlayers)
            {
                throw new InvalidOperationException("Current Game only supports " + MaxPlayers + " players");
            }

            var id = Players.Count;
            var spawn = Map.GetSpawn(id);
            var faction = FactionFactory.GetFaction(factionType, UnitPerPlayer, spawn);
            var player = new Player(name, color, spawn, faction);
            if(aiType != AIType.None)
            {
                var ai = AIFactory.GetAI(aiType, this, player);
                player.SetAI(ai);
            }
            Players.Add(id, player);
            Map.PlayerControlsTile(player, spawn);
        }
コード例 #39
0
        //Incin return spawn Id
        #region Incin

        public static AKSpawnPointType.SpawnId AKGetSpawnIdBySpawnIdwithFacton(AKSpawnPoint spawnpoint, FactionType faction)
        {

            foreach (AKSpawnPoint sp in instances)
            {
                if (sp.faction != faction)
                    continue;

                if (sp.Type.SpawnID != spawnpoint.Type.SpawnID)
                {
                    continue;
                }

                return spawnpoint.Type.SpawnID;

            }
            return AKSpawnPointType.SpawnId.NONE;
        }
コード例 #40
0
 public static bool factionDislikesPlayer(FactionType faction)
 {
     return GlobalManager.factionOpinion[faction] < -0.3;
 }
コード例 #41
0
ファイル: Unit.cs プロジェクト: huytd/fosproject
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnLoad(TextBlock)"/>.</summary>
        protected override bool OnLoad( TextBlock block )
        {
            //for compatibility with old versions.
            if( block.IsAttributeExist( "initFaction" ) )
                initialFaction = (FactionType)EntityTypes.Instance.GetByName(
                    block.GetAttribute( "initFaction" ) );

            return base.OnLoad( block );
        }