// Start is called before the first frame update void Start() { CreatureRequirements requirements = new CreatureRequirements { Wealth = Mathf.Max(Wealth, 1), Conscious = Conscious, Land = Mathf.Max(Land) }; //requirements.Conscious = Cargo; requirements.Mysterious = Mysterious; CreatureFactory factory = new CreatureFactory(requirements); createFactory(factory); }
void Awake() { if (_instance == null && enabled) { _instance = this; if (dontDestroyOnLoad) { DontDestroyOnLoad(this.gameObject); } //spawnedCreatures = new Dictionary<GameObject, CreatureReferences>(); aliveCreatures = new List <Creature>(); } else { Destroy(this); } }
protected virtual bool F207_xxxx_GROUP_IsCreatureAttacking(ILiveEntity enemy) { CreatureFactory L0441_ps_CreatureInfo = AttackProvider.Factory; int A0440_i_Damage = F230_ezzz_GROUP_GetChampionDamage(enemy) + 1; //Champion L0442_ps_Champion = enemy; //if (A0440_i_Damage > L0442_ps_Champion->MaximumDamageReceived) //{ // L0442_ps_Champion->MaximumDamageReceived = A0440_i_Damage; // L0442_ps_Champion->DirectionMaximumDamageReceived = M18_OPPOSITE(L0438_ui_PrimaryDirectionToParty); //} //if (A0440_i_AttackSoundOrdinal = L0441_ps_CreatureInfo->AttackSoundOrdinal) //{ // //TODO sound F064_aadz_SOUND_RequestPlay_COPYPROTECTIOND(G244_auc_Graphic559_CreatureAttackSounds[--A0440_i_AttackSoundOrdinal], P422_i_MapX, P423_i_MapY, C01_MODE_PLAY_IF_PRIORITIZED); //} return(true); }
public void Start() { // Game Initialization // Console window title Title = "GameFramework"; // Initiate logging TraceSource traceSource = new TraceSource("GameFramework_Tracing") { Switch = new SourceSwitch("EventTracing", "All") }; TraceListener eventLog = new TextWriterTraceListener(new StreamWriter("Events.txt")); traceSource.Listeners.Add(eventLog); eventLog.Filter = new EventTypeFilter(SourceLevels.All); _worldItems = new List <Item>(); // Create a new level string[,] grid = LevelParser.ParseTxtFileToArray("Levels/Level_one.txt"); // Generate the World based on the grid _world = new World(grid); // Factory for creating creatures for the world. CAN include a player creature CreatureFactory creaturefac = new CreatureFactory(_world, traceSource); ItemFactory itemFac = new ItemFactory(_world, traceSource); // Generates the player. Since the method has a fixed position for the player, create the player first. _player = creaturefac.CreateNewPlayer(); // Generates a list of monsters to put into the world. creaturefac.CreateNewMonsterList(4); _worldItems.Add(itemFac.GenerateItem(ItemType.Weapon)); _worldItems.Add(itemFac.GenerateItem(ItemType.Armor)); RunGameLoop(); //ReadKey(true); }
public Creature GetCreature() { if (!CreatureInLocation.Any()) { return(null); } int totalChances = CreatureInLocation.Sum(i => i.EncounterChance); int randomNumber = RandomNumberGenerator.NumberBetween(1, totalChances); int Total = 0; foreach (CreatureEncounter creatureEncounter in CreatureInLocation) { Total += creatureEncounter.EncounterChance; if (randomNumber <= Total) { return(CreatureFactory.GetCreature(creatureEncounter.CreatureId)); } } return(CreatureFactory.GetCreature(CreatureInLocation.Last().CreatureId)); }
private void Start() { factory = CreatureFactory.Instance; if (!factory) { enabled = false; return; } nbSpecies = factory.configSpawn.Species.Length; NbCreatures = new int[nbSpecies]; /*for(int i = 0; i < nbSpecies; ++i){ * DebugGUI.SetGraphProperties("population " + i, "Species ID : " + i, 0, 10, 0, new Color(1, 0, 0), true); * DebugGUI.SetGraphProperties("population " + i, "Species ID : " + i, 0, 10, 0, new Color(1, 0, 0), true); * }*/ currentObservedTrait = observedTrait; StartCoroutine(WaitAndUpdateStats()); IsReady = true; }
public void CreateCreatures() { Creature c1 = CreatureFactory.CreateCreaures("Trees"); Creature c2 = CreatureFactory.CreateCreaures("Trees"); }
private void Awake() { Application.runInBackground = true; var protoCreature = QuadrotorFactory.CreateCreature( Vector3.zero, Quaternion.identity); var config = new FCNetworkConfig(); config.Layers.Add(new FCLayerConfig { NumNeurons = protoCreature.NumInputs }); config.Layers.Add(new FCLayerConfig { NumNeurons = 30 }); config.Layers.Add(new FCLayerConfig { NumNeurons = protoCreature.NumOutputs }); Destroy(protoCreature.gameObject); // Create creature bodies _creatures = new List <NeuralCreature>(_populationSize); for (int i = 0; i < _populationSize; i++) { NeuralCreature nc = new NeuralCreature(); Vector3 spawnPos = GetSpawnPosition(i, _populationSize); nc.Body = QuadrotorFactory.CreateCreature( spawnPos, GetSpawnRotation()); nc.Mind = new FCNetwork(config); NeuralUtils.Initialize(nc.Mind, ref _rng); _creatures.Add(nc); } // Create a random genotype to seed the population _genotype = new FCNetwork(config); NeuralUtils.Initialize(_genotype, ref _rng); PrepareNewEpisode(); MutatePopulation(); // Store initial pose so we can reuse creature gameplay objects across tests _creatureInitPose = new List <ITransform>(); CreatureFactory.SerializePose(_creatures[0].Body, _creatureInitPose); Physics.autoSimulation = false; Physics.autoSyncTransforms = false; var colliders = FindObjectsOfType <CapsuleCollider>(); for (int i = 0; i < colliders.Length; i++) { // Bug this doesn't work, why? colliders[i].material = _physicsMaterial; } StartEpisode(); }
int F230_ezzz_GROUP_GetChampionDamage(/*group P493_ps_Group, int */ ILiveEntity P494_i_ChampionIndex) { var champion = P494_i_ChampionIndex; //&G407_s_Party.Champions[P494_i_ChampionIndex]; //if (P494_i_ChampionIndex >= G305_ui_PartyChampionCount) //{ // return 0; //} //if (!champion->CurrentHealth) //{ // return 0; //} //TODO sleeping //if (G300_B_PartyIsSleeping) //{ // F314_gzzz_CHAMPION_WakeUp(); //} int L0563_i_DoubledMapDifficulty = AttackProvider.Location.Tile.Level.Difficulty << 1; CreatureFactory L0564_s_CreatureInfo = AttackProvider.Factory; //G243_as_Graphic559_CreatureInfo[P493_ps_Group->Type]; //F304_apzz_CHAMPION_AddSkillExperience(P494_i_ChampionIndex, C07_SKILL_PARRY, M58_EXPERIENCE(L0564_s_CreatureInfo.Properties)); champion.GetSkill(SkillFactory <ParrySkill> .Instance).AddExperience(L0564_s_CreatureInfo.Experience); bool partySleeping = false; //TODO bool dextrityTest = (champion.GetProperty(PropertyFactory <DextrityProperty> .Instance).Value < rand.Next(32) + /*L0564_s_CreatureInfo.Dexterity*/ AttackProvider.GetProperty(PropertyFactory <DextrityProperty> .Instance).Value + L0563_i_DoubledMapDifficulty - 16) || rand.Next(4) == 0; bool luckTest = !F308_vzzz_CHAMPION_IsLucky(champion, 60); if (partySleeping || (dextrityTest && luckTest)) { IStorageType A0561_ui_AllowedWound = GetAllowedWounds(L0564_s_CreatureInfo); int A0558_i_Attack; if ((A0558_i_Attack = (rand.Next(16) + L0564_s_CreatureInfo.Attack + L0563_i_DoubledMapDifficulty) - (champion.GetSkill(SkillFactory <ParrySkill> .Instance).SkillLevel << 1)) <= 1) { if (rand.Next(2) > 0) { return(0); } A0558_i_Attack = rand.Next(4) + 2; } A0558_i_Attack >>= 1; A0558_i_Attack += rand.Next(A0558_i_Attack) + rand.Next(4); A0558_i_Attack += rand.Next(A0558_i_Attack); A0558_i_Attack >>= 2; A0558_i_Attack += rand.Next(4) + 1; if (rand.Next(2) > 0) { A0558_i_Attack -= rand.Next((A0558_i_Attack >> 1) + 1) - 1; } int A0558_i_Damage; if ((A0558_i_Damage = F321_AA29_CHAMPION_AddPendingDamageAndWounds_GetDamage(P494_i_ChampionIndex, A0558_i_Attack, new[] { A0561_ui_AllowedWound }, L0564_s_CreatureInfo.AttackType)) > 0) { //TODO sounds F064_aadz_SOUND_RequestPlay_COPYPROTECTIOND(C09_SOUND_CHAMPION_0_DAMAGED + P494_i_ChampionIndex, G306_i_PartyMapX, G307_i_PartyMapY, C02_MODE_PLAY_ONE_TICK_LATER); int A0559_ui_PoisonAttack; if ((A0559_ui_PoisonAttack = L0564_s_CreatureInfo.PoisonAttack) > 0 && rand.Next(2) > 0 && ((A0559_ui_PoisonAttack = F307_fzzz_CHAMPION_GetStatisticAdjustedAttack(champion, PropertyFactory <VitalityProperty> .Instance, A0559_ui_PoisonAttack)) >= 0)) { F322_lzzz_CHAMPION_Poison(P494_i_ChampionIndex, A0559_ui_PoisonAttack); } return(A0558_i_Damage); } } return(0); }
public Engine() { this.factory = new CreatureFactory(); this.buyers = new List <IBuyer>(); }
private void TEST_addStuffToWorld() { ICreature bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(9, 94), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(32, 96), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(40, 87), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(66, 86), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(46, 75), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); bat = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.GiantBat, new Vector2(76, 32), this); bat.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(bat); ICreature fireSpirit = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.FireSpirit, new Vector2(82, 23), this); fireSpirit.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(fireSpirit); ICreature manEatingPlant = CreatureFactory.CreateCreature(Creatures.Creatures.ManEatingPlant, new Vector2(53, 33), this); manEatingPlant.Death += new CreatureEvent(HandleCreatureDeath); manEatingPlant.Death += new CreatureEvent(manEatingPlant_Death); _creatures.Add(manEatingPlant); _quests.Add(QuestFactory.MakeQuest(this, manEatingPlant)); _quests[0].AnnounceQuest(); _quests[0].DoneWithQuest += new QuestEvent(World_DoneWithQuest); ICreature golem = CreatureFactory.CreateCreature(Creatures.Creatures.Golem, new Vector2(46, 24), this); golem.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(golem); ICreature skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(65, 33), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(56, 13), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(51, 12), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(63, 5), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(50, 3), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(36, 20), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(34, 13), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(41, 70), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(44, 63), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); skeleton = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.SkeletonWarrior, new Vector2(57, 58), this); skeleton.Death += new CreatureEvent(HandleCreatureDeath); _creatures.Add(skeleton); //ICreature octopus = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.Octopus, new Vector2(11, 87), this); //octopus.Death += new CreatureEvent(HandleCreatureDeath); //_creatures.Add(octopus); //octopus = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.Octopus, new Vector2(14, 94), this); //octopus.Death += new CreatureEvent(HandleCreatureDeath); //_creatures.Add(octopus); //octopus = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.Octopus, new Vector2(65, 22), this); //octopus.Death += new CreatureEvent(HandleCreatureDeath); //_creatures.Add(octopus); ICreature walkingDragon = CreatureFactory.CreateCreature(DodongosQuest.Creatures.Creatures.WalkingDragon, new Vector2(15, 92), this); walkingDragon.Death += new CreatureEvent(HandleCreatureDeath); walkingDragon.FlamingAttack += new CreatureFlameEvent(HandleFlameAttack); _creatures.Add(walkingDragon); IItem doll = ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.CursedDoll, new Vector2(68, 30), this); TreasureChest chest = new TreasureChest(new List <IItem>(), true, new Vector2(68, 30), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfBlindness, new Vector2(68, 30), this)); chest.Contents.Add(doll); _containers.Add(chest); _quests.Add(QuestFactory.MakeItemFindQuest(this, doll)); _quests[1].AnnounceQuest(); _quests[1].DoneWithQuest += new QuestEvent(World_DoneWithQuest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(53, 30), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorHealth, new Vector2(53, 30), this)); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(53, 30), this)); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.OldKey, new Vector2(53, 30), this)); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorEnergy, new Vector2(53, 30), this)); chest.Contents.Add((IItem)WeaponFactory.CreateGiantAxe(new Vector2(53, 30), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(59, 11), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(59, 11), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(53, 11), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorHealth, new Vector2(53, 11), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(17, 17), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorHealth, new Vector2(17, 17), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(66, 60), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(66, 60), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(46, 64), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(46, 64), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(47, 64), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorHealth, new Vector2(47, 64), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(70, 83), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(70, 83), this)); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.PotionOfMinorHealth, new Vector2(70, 83), this)); _containers.Add(chest); chest = new TreasureChest(new List <IItem>(), false, new Vector2(6, 94), this); chest.Contents.Add(ItemFactory.CreateItem(DodongosQuest.Items.ItemTypes.Diamond, new Vector2(6, 94), this)); _containers.Add(chest); _doors.Add(new Door(new Vector2(55, 34), false, this)); _doors.Add(new Door(new Vector2(62, 33), false, this)); _doors.Add(new Door(new Vector2(51, 16), false, this)); _doors.Add(new Door(new Vector2(57, 16), false, this)); _doors.Add(new Door(new Vector2(45, 21), false, this)); _doors.Add(new Door(new Vector2(45, 9), false, this)); _doors.Add(new Door(new Vector2(42, 6), false, this)); _doors.Add(new Door(new Vector2(30, 11), false, this)); _doors.Add(new Door(new Vector2(30, 23), false, this)); _doors.Add(new Door(new Vector2(15, 18), false, this)); _doors.Add(new Door(new Vector2(47, 73), false, this)); _doors.Add(new Door(new Vector2(49, 51), false, this)); _doors.Add(new Door(new Vector2(42, 51), false, this)); _doors.Add(new Door(new Vector2(43, 40), false, this)); _doors.Add(new Door(new Vector2(27, 44), false, this)); }