public Faction getFaction(FactionEnum type)
 {
     foreach (Faction faction in factions)
     {
         if (faction.Type == type)
             return faction;
     }
     return null;
 }
Exemple #2
0
        public PlayerObject createPlayerObject(RaceEnum objectRace, FactionEnum objectFaction, CreatureEnum objectType, GenderEnum objectGender)
        {
            PlayerObject playerObject = new PlayerObject();
            playerObject.Scale = 1;
            playerObject.Velocity = new Vector3(0, 0, 0);
            playerObject.FactionEnum = objectFaction;
            playerObject.RaceEnum = objectRace;
            playerObject.Gender = objectGender;
            playerObject.Name = NameFactory.getName(objectType, objectGender);

            this.createBodySettings(playerObject, objectRace, objectGender);

            return playerObject;
        }
        public PlayerObject createPlayerObject(RaceEnum objectRace, FactionEnum objectFaction, CreatureEnum objectType, GenderEnum objectGender)
        {
            PlayerObject playerObject = new PlayerObject();

            playerObject.Scale       = 1;
            playerObject.Velocity    = new Vector3(0, 0, 0);
            playerObject.FactionEnum = objectFaction;
            playerObject.RaceEnum    = objectRace;
            playerObject.Gender      = objectGender;
            playerObject.Name        = NameFactory.getName(objectType, objectGender);

            this.createBodySettings(playerObject, objectRace, objectGender);

            return(playerObject);
        }
Exemple #4
0
    public Vector3 GetCheckpointPosition(int index, FactionEnum faction)
    {
        if (index < 0 || index >= checkPoints.Count)
        {
            return(Vector3.zero);
        }

        //blue needs to go in opposite direction
        if (faction == FactionEnum.AI)
        {
            index = checkPoints.Count - 1 - index;
        }

        return(checkPoints[index].transform.position);
    }
Exemple #5
0
        public static bool friendOf(FactionEnum fac1, FactionEnum fac2)
        {
            BaseFaction factionA = getFaction(fac1);

            if (factionA != null)
            {
                for (int i = 0; i < factionA.Allys.Length; i++)
                {
                    if (factionA.Allys[i] == fac2)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #6
0
        public NpcObject createNpcObject(RaceEnum objectRace, FactionEnum objectFaction, CreatureEnum objectType, GenderEnum objectGender)
        {
            NpcObject npcObject = new NpcObject();
            npcObject.Scale = 1;
            npcObject.Velocity = new Vector3(0, 0, 0);
            npcObject.FactionEnum = objectFaction;
            npcObject.RaceEnum = objectRace;
            npcObject.Gender = objectGender;
            npcObject.Name = NameFactory.getName(objectType, objectGender);

            this.createBodySettings(npcObject, objectRace, objectGender);

            npcObject.Tasks.Add(new Model.Object.Task.Tasks.AttackRandomTask(npcObject, Model.Object.Task.Tasks.TaskPriority.Attack_Random));
            //npcObject.Tasks.Add(new Model.Object.Task.Tasks.WalkRandomTask(npcObject, Model.Object.Task.Tasks.TaskPriority.Walk_Random));

            return npcObject;
        }
 private BaseFaction getFaction(FactionEnum fe)
 {
     if (mOwner == null)
     {
         return(null);
     }
     if (!FactionsBank.ContainsKey(fe))
     {
         return(null);
     }
     if (!mReputations.ContainsKey(fe))
     {
         mOwner.SendMessage(95, "Vous rencontrez une nouvelle faction: " + FactionsBank[fe].Name + " !");
         mReputations.Add(fe, 0);
     }
     return(FactionsBank[fe]);
 }
        public NpcObject createNpcObject(RaceEnum objectRace, FactionEnum objectFaction, CreatureEnum objectType, GenderEnum objectGender)
        {
            NpcObject npcObject = new NpcObject();

            npcObject.Scale       = 1;
            npcObject.Velocity    = new Vector3(0, 0, 0);
            npcObject.FactionEnum = objectFaction;
            npcObject.RaceEnum    = objectRace;
            npcObject.Gender      = objectGender;
            npcObject.Name        = NameFactory.getName(objectType, objectGender);

            this.createBodySettings(npcObject, objectRace, objectGender);

            npcObject.Tasks.Add(new AttackRandomTask(npcObject, TaskPriority.Attack_Random));
            //npcObject.Tasks.Add(new Model.Object.Task.Tasks.WalkRandomTask(npcObject, Model.Object.Task.Tasks.TaskPriority.Walk_Random));

            return(npcObject);
        }
Exemple #9
0
    public bool SpawnMinerUnit(int unitIndex, FactionEnum faction, Material factionMaterial, int balance)
    {
        if (_spawnedMiners >= GetComponent <Outpost>().MaxMinerUnits)
        {
            return(false);
        }

        var unitPrefab = unitPrefabs[unitIndex];

        var unitObject = Instantiate(unitPrefab, transform);

        var unit = unitObject.GetComponent <MinerUnit>();

        unit.Initialize(faction, factionMaterial);

        _spawnedMiners++;

        return(true);
    }
Exemple #10
0
    public void OnArrowAbilityUpgraded(ArrowAbilityData arrowAbilityData, FactionEnum faction)
    {
        if (faction != FactionEnum.Player)
        {
            return;
        }

        arrowAbilityName.text         = arrowAbilityData.Name;
        arrowAbilityImage.sprite      = arrowAbilityData.Sprite;
        arrowAbilityDamage.text       = arrowAbilityData.Damage.ToString();
        arrowAbilityCooldown.text     = arrowAbilityData.Cooldown.ToString();
        arrowAbilityUpgradePrice.text = arrowAbilityData.UpgradePrice.ToString();

        if (arrowAbilityData.UpgradePrice == 0)
        {
            upgradeContainer.SetActive(false);
            maxLevelContainer.SetActive(true);
        }
    }
Exemple #11
0
    public void OnOutpostUpgraded(OutpostData outpostData, FactionEnum faction)
    {
        if (faction != FactionEnum.Player)
        {
            return;
        }

        outpostName.text          = outpostData.Name;
        outpostImage.sprite       = outpostData.Sprite;
        outpostHitpoints.text     = outpostData.Health.ToString();
        outpostTrainCapacity.text = outpostData.MaxQueueCapacity.ToString();
        outpostMinerCapacity.text = outpostData.MaxMinerUnits.ToString();
        outpostUpgradeCost.text   = outpostData.UpgradePrice.ToString();

        if (outpostData.UpgradePrice == 0)
        {
            upgradeContainer.SetActive(false);
            maxLevelContainer.SetActive(true);
        }
    }
Exemple #12
0
        public GumpFactions(NubiaPlayer _owner)
            : base("Factions & Réputations", 380, 405)
        {
            Closable = true;
            mOwner   = _owner;
            int y     = YBase;
            int x     = XBase;
            int line  = 0;
            int scale = 27;
            int decal = 5;

            if (mOwner == null)
            {
                return;
            }
            if (mOwner.ReputationStack == null)
            {
                return;
            }

            for (int i = 0; i < (int)FactionEnum.Maximum; i++)
            {
                FactionEnum faction = (FactionEnum)i;
                if (mOwner.ReputationStack.Reputations.ContainsKey(faction))
                {
                    BaseFaction fac = FactionHelper.getFaction(faction);
                    if (fac != null)
                    {
                        ReputationEnum reput = ReputationEnum.Neutre;
                        int            val   = mOwner.ReputationStack.getReputation(faction);
                        reput = FactionHelper.getReputForVal(val);
                        AddImage(x, line * scale + y - 3, 2440);
                        AddLabel(x + 10, y + line * scale, ColorText, fac.Name);

                        AddImage(x + 180, line * scale + y - 3, 2440);
                        AddLabel(x + 190, y + line * scale, FactionHelper.getHueForReput(reput), FactionHelper.getNameForReput(reput));
                        line++;
                    }
                }
            }
        }
Exemple #13
0
    public static void FactionVsFaction(FactionEnum factionA, FactionEnum factionB)
    {
        List <GameObject> factionAships = new List <GameObject>();
        List <GameObject> factionBships = new List <GameObject>();

        switch (factionA)
        {
        case FactionEnum.Pirate:
            factionAships.AddRange(MissionRes.pirateships);
            break;

        case FactionEnum.Guard:
            factionAships.AddRange(MissionRes.guardships);
            break;

        case FactionEnum.Prisoner:
            factionAships.AddRange(MissionRes.prisonerships);
            break;

        default:
            break;
        }

        switch (factionB)
        {
        case FactionEnum.Pirate:
            factionBships.AddRange(MissionRes.pirateships);
            break;

        case FactionEnum.Guard:
            factionBships.AddRange(MissionRes.guardships);
            break;

        case FactionEnum.Prisoner:
            factionBships.AddRange(MissionRes.prisonerships);
            break;

        default:
            break;
        }
    }
    public void OnUnitUpgraded(int upgradedUnitIndex, UnitData upgradedUnitData, FactionEnum faction)
    {
        if (faction != FactionEnum.Player)
        {
            return;
        }

        if (upgradedUnitIndex != unitIndex)
        {
            return;
        }

        UnitData = upgradedUnitData;

        priceText.text = UnitData.TrainCost.ToString();

        if (UnitData.Sprite != null)
        {
            unitImage.sprite = UnitData.Sprite;
        }
    }
Exemple #15
0
    public int SpawnUnit(int unitIndex, Line line, FactionEnum faction, Material factionMaterial, int balance)
    {
        if (unitIndex < 0 || unitIndex > unitPrefabs.Count - 1)
        {
            return(0);
        }

        if (_unitsInQueue.Count >= _maxQueueCapacity)
        {
            return(0);
        }

        var unitPrefab = unitPrefabs[unitIndex];

        int cost = unitPrefab.GetComponent <Unit>().GetUnitData(_currentUnitTiers[unitIndex]).TrainCost;

        if (cost > balance)
        {
            return(0);
        }

        var unitObject = Instantiate(unitPrefab, transform);

        var unit = unitObject.GetComponent <Unit>();

        unit.Initialize(_unitIDCounter++, _currentUnitTiers[unitIndex], line, faction, factionMaterial);
        if (unitIndex != 4)
        {
            unit.OnUnitDeath.AddListener(RemoveUnit); // TODO zisti na kereho anciasa to nejde na minera
        }

        unit.gameObject.SetActive(false);

        _unitsInQueue.Add(unit);
        _unitsInQueueIndex.Add(unitIndex);
        UpdateQueueCapacityText();
        return(cost);
    }
 public void Initialize(FactionEnum faction)
 {
     Faction = faction;
 }
 public FactionObject(SerializationInfo info, StreamingContext ctxt)
     : base(info, ctxt)
 {
     this.factionEnum = (FactionEnum)info.GetValue("factionEnum", typeof(FactionEnum));
 }
Exemple #18
0
 public FactionObject(SerializationInfo info, StreamingContext ctxt)
     : base(info, ctxt)
 {
     this.factionEnum = (FactionEnum)info.GetValue("factionEnum", typeof(FactionEnum));
 }