示例#1
0
    public void SetDef(AnimalDef def)
    {
        Def = def;

        name = def.Name;
        SpriteRenderer.sprite = Def.Sprite;
    }
    public static ExplorationEvent stealEggs()
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef chicken = new AnimalDef();

        chicken.SizeTrait    = SizeFactory.createTiny();
        chicken.SpeciesTrait = SpeciesFactory.createChicken();

        List <AnimalDef> twoChickens = new List <AnimalDef>()
        {
            chicken, chicken
        };

        List <ExplorationCriteria> variableChickenReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), int.MinValue, 6, new RewardImpl.RandomAnimalPenalty()),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 6, 10, new RewardImpl.DoNothingReward("The Chicken looks kinda scary, and you back off.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 10, 20, new RewardImpl.AnimalReward(chicken, "You defeat the mother and get one unbroken egg from the nest.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 20, int.MaxValue, new RewardImpl.AnimalReward(twoChickens, "After defeating the mother there are two viable eggs left in the nest."))
        };

        e.description = "You see a nest with a few eggs.  Its mother, a hugely oversized chicken, is nearby.";
        e.options     = new List <ExplorationEvent.Option>()
        {
            new ExplorationEvent.Option("Fight the chicken", variableChickenReward),
            new ExplorationEvent.Option("Run like the wind", TraitFactory.Attribute.Tracking.ToString(), 4, new RewardImpl.DoNothingReward("You run away"), new RewardImpl.RandomAnimalPenalty(), new List <string>()),
            new ExplorationEvent.Option("Build a defensive wall", TraitFactory.Attribute.Strength.ToString(), 20, new RewardImpl.DoNothingReward("You build a wall and make the chicken pay for it."), new RewardImpl.RandomAnimalPenalty(), new List <string>())
        };

        return(e);
    }
示例#3
0
    protected ExplorationEvent attackedBy(SpeciesFactory.Species species, int numAttackers, string trumpOption)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        int foodReward = animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()) * numAttackers;

        string foodString = "";

        if (numAttackers == 1)
        {
            e.description = "You are attacked by a wild " + species.ToString();
            foodString    = "You killed the " + species.ToString() + " and harvest its meat to feed your animals";
        }
        else
        {
            e.description = "You are attacked by a pack of " + numAttackers + " wild " + species.ToString();
            foodString    = "You killed every last " + species.ToString() + " and make a meal of their corpses.  you collect a feast of " + foodReward + " food.";
        }

        e.options = new List <ExplorationEvent.Option>();

        int fightScore    = Mathf.FloorToInt(animalReward.GetAttributeScore(TraitFactory.Attribute.Fighting.ToString()) * (0.5f + numAttackers));
        int trackingScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString());



        List <ExplorationCriteria> variableAnimalReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), int.MinValue, fightScore * 2, new RewardImpl.RandomAnimalPenalty("The pack of wild " + species.ToString() + " tear one of your animals apart.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), fightScore * 2, fightScore * 2 + 3, new RewardImpl.FoodPenalty(25,
                                                                                                                                               "The " + species.ToString() + " nearly killed you.  Before you dealt the winning blow it tore into your pack and scatterd your suppplies.  You lost 25 food.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), fightScore * 2 + 3, int.MaxValue, new RewardImpl.FoodReward(foodReward, foodString))
        };

        List <ExplorationCriteria> variableTrackingReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore, new RewardImpl.RandomAnimalPenalty("You did not run faster than the pack of wild " + species.ToString() + ".")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore, trackingScore * 2,
                                    new RewardImpl.FoodPenalty(animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()), "You drop some of your supplies as you run.  You lose " + animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()) + " food")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 2, int.MaxValue, new RewardImpl.DoNothingReward("You escape without losing any of your animals"))
        };


        e.options.Add(new ExplorationEvent.Option("Stand your ground.", variableAnimalReward));
        e.options.Add(new ExplorationEvent.Option("Run like the wind.", variableTrackingReward));

        if (trumpOption != null)
        {
            e.options.Add(
                new ExplorationEvent.Option("Lucky for you, " + species.ToString() + " are afraid of " + trumpOption + ", you can scare them away.", TraitFactory.Attribute.Fighting.ToString(), 0, new RewardImpl.AnimalReward(animalReward), new RewardImpl.DoNothingReward("Nothing interesting happens."), new List <string>()
            {
                trumpOption
            }));
        }

        return(e);
    }
示例#4
0
    public void AddNewSpeciesToDeck(AnimalDef currentAnimal)
    {
        // evolve from current animal
        AnimalDef ad = currentAnimal.Evolved();

        //m_animalDeck.Insert(0,ad);
        m_animalQueue[QUEUE_LENGTH - 1] = ad;
    }
示例#5
0
    public void SetDef(AnimalDef def)
    {
        Texture2D tex = AnimalAssetManager.Instance.GetAnimalTexture(def.m_animalType) as Texture2D;

        //Animal animalController = animal.GetComponent<Animal>();
        SetAnimalTexture(tex);
        SetColor((int)def.m_colour);
    }
    public GameObject createFromDef(AnimalDef def)
    {
        GameObject animal       = GameObject.Instantiate(animalPrefab);
        Animal     animalScript = animal.GetComponent <Animal>();

        animalScript.Initialize(def.SpeciesTrait, def.SizeTrait);
        animalScript.Traits = def.Traits;
        return(animal);
    }
示例#7
0
    public AnimalDef PopFromQueue(int usedPieceIndex)
    {
        AnimalDef nextAnimal = m_animalQueue[usedPieceIndex];

        for (int i = usedPieceIndex; i < QUEUE_LENGTH - 1; i++)
        {
            m_animalQueue[i] = m_animalQueue[i + 1];
        }
        m_animalQueue[QUEUE_LENGTH - 1] = PullAnimalFromDeck();

        return(nextAnimal);
    }
示例#8
0
    protected ExplorationEvent findACave(SpeciesFactory.Species species)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        e.description = "You come across a cave, the opening looks treacherous. You think you hear an animal inside.";
        e.options     = new List <ExplorationEvent.Option>();

        List <AnimalDef> twoAnimals = new List <AnimalDef>()
        {
            animalReward, animalReward
        };


        int strengthScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Strength.ToString());

        List <ExplorationCriteria> variableAnimalReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, strengthScore, new RewardImpl.RandomAnimalPenalty("Somestimes things go into a cave, but don't come out.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), strengthScore, strengthScore * 3, new RewardImpl.DoNothingReward("You can't clear the entrance.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), strengthScore * 3, strengthScore * 6, new RewardImpl.AnimalReward(animalReward, "You find a baby " + species.ToString() + " in the cave.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), strengthScore * 6, int.MaxValue, new RewardImpl.AnimalReward(twoAnimals))
        };

        e.options.Add(new ExplorationEvent.Option("Attempt to clear the entrance.", variableAnimalReward));

        int trackingScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString());

        List <ExplorationCriteria> variableTrackingReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore, new RewardImpl.RandomAnimalPenalty()),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore, trackingScore * 3, new RewardImpl.DoNothingReward("You don't find another way in.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 3, trackingScore * 6, new RewardImpl.AnimalReward(animalReward)),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 6, int.MaxValue, new RewardImpl.AnimalReward(twoAnimals, "There were 2 of them in there.  You capture 2 baby " + species.ToString() + "."))
        };

        e.options.Add(new ExplorationEvent.Option("Attempt to find another way in.", variableTrackingReward));

        e.options.Add(new ExplorationEvent.Option("Walk away.", TraitFactory.Attribute.Tracking.ToString(), 0, new RewardImpl.DoNothingReward("You walk away."), new RewardImpl.DoNothingReward("You walk away.")));
        e.options.Add(
            new ExplorationEvent.Option("Send your climbing creature in.", TraitFactory.Attribute.Tracking.ToString(), trackingScore - 2, new RewardImpl.AnimalReward(animalReward, "Your climbing creature leads the way and finds a baby " + species.ToString() + "."),
                                        new RewardImpl.RandomAnimalPenalty("Even with a climbing creature to guide you, caves can still be hazzardous."), new List <string>()
        {
            TraitFactory.Traits.Climb.ToString()
        }));
        e.options.Add(
            new ExplorationEvent.Option("Dig through the rubble.", TraitFactory.Attribute.Strength.ToString(), strengthScore - 2, new RewardImpl.AnimalReward(animalReward, "You dig and dig until you find a baby " + species.ToString() + "."), new RewardImpl.DoNothingReward("You don't find anything."), new List <string>()
        {
            TraitFactory.Traits.Dig.ToString()
        }));
        return(e);
    }
示例#9
0
    AnimalDef PullAnimalFromDeck()
    {
        if (m_animalDeck.Count == 0)
        {
            InitAnimalDeck();
        }

        AnimalDef ad = m_animalDeck[0];

        m_animalDeck.RemoveAt(0);
        return(ad);
    }
示例#10
0
    AnimalDef RandomAnimal()
    {
        AnimalDef.AnimalTypes[] animalTypesArray = Enum.GetValues(typeof(AnimalDef.AnimalTypes)) as AnimalDef.AnimalTypes[];
        AnimalDef.ColorTypes[]  colorTypesArray  = Enum.GetValues(typeof(AnimalDef.ColorTypes)) as AnimalDef.ColorTypes[];

        AnimalDef.AnimalTypes type   = animalTypesArray[UnityEngine.Random.Range(0, INITIAL_NUM_ANIMAL_TYPES)];         //animalTypesArray.Length)];
        AnimalDef.ColorTypes  colour = colorTypesArray[UnityEngine.Random.Range(0, colorTypesArray.Length)];

        AnimalDef ad = new AnimalDef(type, colour);

        return(ad);
    }
示例#11
0
    GameObject ShowEvolvedAnimal(AnimalDef animalDef)
    {
        GameObject animal = Instantiate(m_newAnimalPrefab, Vector3.zero, Quaternion.identity);

        animal.transform.SetParent(transform);
        animal.transform.localPosition = new Vector3(0f, 0f, -1.5f);
        animal.transform.localScale    = new Vector3(1f, 1f);

        Animal animalController = animal.GetComponent <Animal>();

        animalController.SetDef(animalDef);

        return(animal);
    }
示例#12
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            if (AnimalDef == null || !(parms.target is Map map))
            {
                return(false);
            }

            if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Animal))
            {
                return(false);
            }

            if (Quantity <= 0)
            {
                Quantity = Mathf.Clamp(GenMath.RoundRandom(2.5f / AnimalDef.RaceProps.baseBodySize), 2, 10);
            }

            var container = new List <Pawn>();

            for (var _ = 0; _ < Quantity; _++)
            {
                IntVec3 pos  = CellFinder.RandomClosewalkCellNear(loc, map, 12);
                Pawn    pawn = GeneratePawn();

                GenSpawn.Spawn(pawn, pos, map, Rot4.Random);

                if (Gender.HasValue && pawn.gender != Gender.Value)
                {
                    pawn.gender = Gender.Value;
                }

                if (SpawnManhunter)
                {
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter);
                }

                container.Add(pawn);
            }

            SendStandardLetter(
                Label ?? "LetterLabelFarmAnimalsWanderIn".LocalizeKeyed(AnimalDef.GetLabelPlural()),
                Text ?? "LetterFarmAnimalsWanderIn".LocalizeKeyed(AnimalDef.GetLabelPlural()),
                SpawnManhunter ? LetterDefOf.NegativeEvent : LetterDefOf.NeutralEvent,
                parms,
                new LookTargets(container)
                );

            return(true);
        }
示例#13
0
    protected ExplorationEvent animalBabyFightMother(SpeciesFactory.Species species, string trumpOption)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        e.description = "You come across a baby " + species.ToString() + ", its mother is nearby.";
        e.options     = new List <ExplorationEvent.Option>();

        List <AnimalDef> twoAnimals = new List <AnimalDef>()
        {
            animalReward, animalReward
        };

        int fightScore    = animalReward.GetAttributeScore(TraitFactory.Attribute.Fighting.ToString());
        int trackingScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString());

        List <ExplorationCriteria> variableAnimalReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), int.MinValue, fightScore * 2, new RewardImpl.RandomAnimalPenalty("The mother " + species.ToString() + " slaughters one of your animals before retreting to safety with her baby.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), fightScore * 2, fightScore * 2 + 1, new RewardImpl.DoNothingReward("The " + species.ToString() + " looks kinda scary, and you back off.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), fightScore * 2 + 1, fightScore * 4, new RewardImpl.AnimalReward(animalReward, "You feel great about killing a mother " + species.ToString() + " and enslaving her child")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), fightScore * 4, int.MaxValue, new RewardImpl.AnimalReward(twoAnimals, "You defeat the mother " + species.ToString() + " and notice another second baby hiding behind her corpse.  You capture 2 baby " + species.ToString()))
        };

        List <ExplorationCriteria> variableTrackingReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore, new RewardImpl.RandomAnimalPenalty("You're not very quiet, but don't have to run faster than the " + species.ToString() + ".  You just have to run faster than the slowest animal in your party.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore, trackingScore * 2, new RewardImpl.DoNothingReward("You escape.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 2, trackingScore * 4, new RewardImpl.FoodReward(animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()), "After you escape you find " + animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()) + " food with your keen tracking skills")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 4, int.MaxValue, new RewardImpl.AnimalReward(animalReward, "You manage to grab the baby " + species.ToString() + " as you walk away without the mother even noticing"))
        };


        e.options.Add(new ExplorationEvent.Option("Grab it.  You are not afraid of a mama " + species.ToString() + ".", variableAnimalReward));
        e.options.Add(new ExplorationEvent.Option("Walk away quietly.", variableTrackingReward));

        if (trumpOption != null)
        {
            e.options.Add(
                new ExplorationEvent.Option("Because you have " + trumpOption + ", you can scare the mom away.", TraitFactory.Attribute.Fighting.ToString(), 0, new RewardImpl.AnimalReward(animalReward), new RewardImpl.DoNothingReward("Nothing interesting happens."), new List <string>()
            {
                trumpOption
            }));
        }

        return(e);
    }
示例#14
0
    IEnumerator SetCompleteSequenceMatchingSet()
    {
        const float MOVE_TOGETHER_TIME = 0.5f;
        const float SCALE_UP_TIME      = 0.2f;
        const float SCALE_FACTOR       = 2.5f;
        const float WOBBLE_TIME        = 0.2f;
        const float WOBBLE_COUNT       = 2;
        const float WOBBLE_FACTOR      = 0.15f;
        const float MOVE_TO_QUEUE_TIME = 0.2f;

        ScaleAll(0.1f, MOVE_TOGETHER_TIME, true);
        MoveTogether(MOVE_TOGETHER_TIME, false);

        yield return(new WaitForSeconds(MOVE_TOGETHER_TIME - 0.1f));

        AnimalDef  evolvedAnimal       = m_lastPiecePlaced.Evolved();
        GameObject evolvedAnimalSprite = ShowEvolvedAnimal(evolvedAnimal);
        Scaler     scaler = evolvedAnimalSprite.GetComponent <Scaler>();

        scaler.ScaleBy(new Vector3(SCALE_FACTOR, SCALE_FACTOR, 0f), SCALE_UP_TIME);
        for (int i = 0; i < WOBBLE_COUNT; i++)
        {
            yield return(new WaitForSeconds(WOBBLE_TIME));

            scaler.ScaleBy(new Vector3(-WOBBLE_FACTOR, -WOBBLE_FACTOR, 0f), WOBBLE_TIME);
            yield return(new WaitForSeconds(WOBBLE_TIME));

            scaler.ScaleBy(new Vector3(WOBBLE_FACTOR, WOBBLE_FACTOR, 0f), WOBBLE_TIME);
        }

        yield return(new WaitForSeconds(1.0f));

        Mover mov = evolvedAnimalSprite.GetComponent <Mover>();

        mov.MoveTo(GameController.Instance.m_animalQueueLocations[2].position, MOVE_TO_QUEUE_TIME);
        scaler.ScaleTo(new Vector3(1f, 1f), MOVE_TO_QUEUE_TIME);

        yield return(new WaitForSeconds(0.5f));

        Destroy(evolvedAnimalSprite);

        ClearSet();
    }
示例#15
0
    public PlaceAnimalResult AddAnimal(GameObject prefab, AnimalDef animalDef)
    {
        int animalID    = (int)animalDef.m_animalType;
        int animalColor = (int)animalDef.m_colour;

        if (m_setAnimalID == -1)
        {
            m_setAnimalID = animalID;
        }

//		if (m_setAnimalID != animalID)
//		{
//			// can't add this animal to this set
//			m_placedPiecePosition = null;
//			return false;
//		}

        if (m_slotContents[animalColor] != -1)
        {
            // already have this color
            m_placedPiecePosition = null;
            return(PlaceAnimalResult.NOT_PLACED);
        }

        m_lastPiecePlaced           = animalDef;
        m_slotContents[animalColor] = animalID;

        GameObject animal = Instantiate(prefab, Vector3.zero, Quaternion.identity);

        animal.transform.SetParent(m_slots[animalColor]);
        animal.transform.localPosition = Vector3.zero;

        m_placedPiecePosition = m_slots[animalColor];

        Animal animalController = animal.GetComponent <Animal>();

        animalController.SetDef(animalDef);

        return(CheckForCompletedSet());
    }
    protected ExplorationEvent babyIslandSwim(SpeciesFactory.Species species)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        e.description = "You come across a baby " + species.ToString() + " on an island.";
        e.options     = new List <ExplorationEvent.Option>();

        List <AnimalDef> twoAnimals = new List <AnimalDef>()
        {
            animalReward, animalReward
        };

        int strengthScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Strength.ToString());

        List <ExplorationCriteria> variableAnimalReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Strength.ToString(), int.MinValue, strengthScore, new RewardImpl.RandomAnimalPenalty("The current was too swift.")),
            new ExplorationCriteria(TraitFactory.Attribute.Strength.ToString(), strengthScore, strengthScore * 2, new RewardImpl.DoNothingReward("The tree doesn't budge.")),
            new ExplorationCriteria(TraitFactory.Attribute.Strength.ToString(), strengthScore * 2, int.MaxValue, new RewardImpl.AnimalReward(animalReward, "You crosses the water and captured a baby " + species.ToString()))
        };

        e.options.Add(new ExplorationEvent.Option("There is a tree nearby, you can try to push it over.", variableAnimalReward));
        e.options.Add(new ExplorationEvent.Option("Walk away.", TraitFactory.Attribute.Tracking.ToString(), 0, new RewardImpl.DoNothingReward("You walk away."), new RewardImpl.DoNothingReward("You walk away.")));

        e.options.Add(
            new ExplorationEvent.Option("Because you have swim, you can reach the island and get the baby.", TraitFactory.Attribute.Fighting.ToString(), 0, new RewardImpl.AnimalReward(animalReward), new RewardImpl.AnimalReward(animalReward), new List <string>()
        {
            TraitFactory.Traits.Swim.ToString()
        }));
        e.options.Add(
            new ExplorationEvent.Option("Because you have flying, you can reach the island and get the baby.", TraitFactory.Attribute.Fighting.ToString(), 0, new RewardImpl.AnimalReward(animalReward), new RewardImpl.AnimalReward(animalReward), new List <string>()
        {
            TraitFactory.Traits.Flying.ToString()
        }));
        return(e);
    }
示例#17
0
    protected ExplorationEvent babyInATree(SpeciesFactory.Species species)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        e.description = "You come across a baby " + species.ToString() + " in a tree.";
        e.options     = new List <ExplorationEvent.Option>();

        List <AnimalDef> twoAnimals = new List <AnimalDef>()
        {
            animalReward, animalReward
        };

        int trackingScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString());

        List <ExplorationCriteria> variableAnimalReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore, new RewardImpl.RandomAnimalPenalty("You discover that falling from a tree can be fatal.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore, trackingScore * 2, new RewardImpl.DoNothingReward("You can't reach it.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 2, trackingScore * 5, new RewardImpl.AnimalReward(animalReward, "You 'rescue' the baby " + species.ToString() + ".  It will never have suffer the pains of freedom again.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 5, int.MaxValue, new RewardImpl.AnimalReward(twoAnimals, "There were 2 of them up there.  You capture 2 baby " + species.ToString() + "."))
        };

        e.options.Add(new ExplorationEvent.Option("Attempt to climb the tree to get it.", variableAnimalReward));
        e.options.Add(new ExplorationEvent.Option("Walk away.", TraitFactory.Attribute.Tracking.ToString(), 0, new RewardImpl.DoNothingReward("You walk away."), new RewardImpl.DoNothingReward("You walk away.")));
        e.options.Add(
            new ExplorationEvent.Option("Send your climbing creature after it.", TraitFactory.Attribute.Tracking.ToString(), 0, new RewardImpl.AnimalReward(animalReward, "Your climbing creature brings the baby " + species.ToString() + " down from the tree"), new RewardImpl.AnimalReward(animalReward), new List <string>()
        {
            TraitFactory.Traits.Climb.ToString()
        }));
        e.options.Add(
            new ExplorationEvent.Option("Send your flying creature after it.", TraitFactory.Attribute.Tracking.ToString(), 0, new RewardImpl.AnimalReward(animalReward, "Your flying creature brings the baby " + species.ToString() + " down from the tree"), new RewardImpl.AnimalReward(animalReward), new List <string>()
        {
            TraitFactory.Traits.Flying.ToString()
        }));
        return(e);
    }
示例#18
0
 public AnimalReward(AnimalDef animal, string message)
 {
     animals.Add(animal);
     this.message = message;
 }
示例#19
0
 /// Add a plant definition to our plant dictionary
 public static void AddAnimal(AnimalDef def)
 {
     Defs.animals.Add(def.uid, def);
 }
示例#20
0
    public static AnimalDef CreateDefForSpecies(SpeciesFactory.Species species, bool assignRandomTraits)
    {
        AnimalDef animalDef = new AnimalDef();

        switch (species)
        {
        case SpeciesFactory.Species.Cow:
            animalDef.SpeciesTrait = SpeciesFactory.createCow();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Lion:
            animalDef.SpeciesTrait = SpeciesFactory.createLion();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Turtle:
            animalDef.SpeciesTrait = SpeciesFactory.createTurtle();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Turkey:
            animalDef.SpeciesTrait = SpeciesFactory.createTurkey();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Lobster:
            animalDef.SpeciesTrait = SpeciesFactory.createLobster();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Wolf:
            animalDef.SpeciesTrait = SpeciesFactory.createWolf();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Bat:
            animalDef.SpeciesTrait = SpeciesFactory.createBat();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Bison:
            animalDef.SpeciesTrait = SpeciesFactory.createBison();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Bear:
            animalDef.SpeciesTrait = SpeciesFactory.createBear();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Bee:
            animalDef.SpeciesTrait = SpeciesFactory.createBee();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Crocodile:
            animalDef.SpeciesTrait = SpeciesFactory.createCrocodile();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Bulldog:
            animalDef.SpeciesTrait = SpeciesFactory.createBulldog();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Tiger:
            animalDef.SpeciesTrait = SpeciesFactory.createTiger();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Deer:
            animalDef.SpeciesTrait = SpeciesFactory.createDeer();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Bluejay:
            animalDef.SpeciesTrait = SpeciesFactory.createBluejay();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Cat:
            animalDef.SpeciesTrait = SpeciesFactory.createCat();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Alligator:
            animalDef.SpeciesTrait = SpeciesFactory.createAlligator();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.BaldEagle:
            animalDef.SpeciesTrait = SpeciesFactory.createBaldEagle();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Sheep:
            animalDef.SpeciesTrait = SpeciesFactory.createSheep();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Panda:
            animalDef.SpeciesTrait = SpeciesFactory.createPanda();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Fox:
            animalDef.SpeciesTrait = SpeciesFactory.createFox();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Elephant:
            animalDef.SpeciesTrait = SpeciesFactory.createElephant();
            animalDef.SizeTrait    = SizeFactory.createEnormous();
            break;

        case SpeciesFactory.Species.Dog:
            animalDef.SpeciesTrait = SpeciesFactory.createDog();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Chicken:
            animalDef.SpeciesTrait = SpeciesFactory.createChicken();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Gorilla:
            animalDef.SpeciesTrait = SpeciesFactory.createGorilla();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Owl:
            animalDef.SpeciesTrait = SpeciesFactory.createOwl();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Horse:
            animalDef.SpeciesTrait = SpeciesFactory.createHorse();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Frog:
            animalDef.SpeciesTrait = SpeciesFactory.createFrog();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Giraffe:
            animalDef.SpeciesTrait = SpeciesFactory.createGiraffe();
            animalDef.SizeTrait    = SizeFactory.createEnormous();
            break;

        case SpeciesFactory.Species.Moose:
            animalDef.SpeciesTrait = SpeciesFactory.createMoose();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Mouse:
            animalDef.SpeciesTrait = SpeciesFactory.createMouse();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Canary:
            animalDef.SpeciesTrait = SpeciesFactory.createCanary();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Pig:
            animalDef.SpeciesTrait = SpeciesFactory.createPig();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Hippo:
            animalDef.SpeciesTrait = SpeciesFactory.createHippo();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Donkey:
            animalDef.SpeciesTrait = SpeciesFactory.createDonkey();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Monkey:
            animalDef.SpeciesTrait = SpeciesFactory.createMonkey();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Duck:
            animalDef.SpeciesTrait = SpeciesFactory.createDuck();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Snake:
            animalDef.SpeciesTrait = SpeciesFactory.createSnake();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Penguin:
            animalDef.SpeciesTrait = SpeciesFactory.createPenguin();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Rhino:
            animalDef.SpeciesTrait = SpeciesFactory.createRhino();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Rabbit:
            animalDef.SpeciesTrait = SpeciesFactory.createRabbit();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        default:
            break;
        }

        List <BaseTrait> allTraits = new List <BaseTrait>();

        allTraits.Add(animalDef.SpeciesTrait);
        allTraits.Add(animalDef.SizeTrait);
        animalDef.Traits = TraitSelector.selectTraits(allTraits);
        return(animalDef);
    }
示例#21
0
    protected ExplorationEvent rescueFromQuicksand(SpeciesFactory.Species species, int numAttackers = 1)
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef animalReward = AnimalDefFactory.CreateDefForSpecies(species);

        int foodReward = animalReward.GetAttributeScore(TraitFactory.Attribute.Food.ToString()) * numAttackers;

        string foodString = "";

        if (numAttackers == 1)
        {
            e.description = "You see a " + species.ToString() + " trapped in the quicksand";
            foodString    = "You rescued the " + species.ToString() + " and harvest its meat to feed your animals";
        }
        else
        {
            e.description = "You see " + numAttackers + " " + species.ToString() + " trapped in the quicksand";
            foodString    = "You killed every last " + species.ToString() + " and make a meal of their corpses.  you collect a feast of " + foodReward + " food.";
        }

        string tameString = "";

        if (numAttackers == 1)
        {
            e.description = "You see a " + species.ToString() + " trapped in the quicksand";
            tameString    = "You rescued the " + species.ToString() + " and it joins you.";
        }
        else
        {
            e.description = "You see " + numAttackers + " " + species.ToString() + " trapped in the quicksand";
            tameString    = "You rescued every last " + species.ToString() + " and they join you.";
        }

        e.options = new List <ExplorationEvent.Option>();

        int trackingScore = Mathf.FloorToInt(animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString()) * (0.5f + numAttackers));
        //int trackingScore = animalReward.GetAttributeScore(TraitFactory.Attribute.Tracking.ToString());


        List <ExplorationCriteria> variableFoodReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore * 2, new RewardImpl.RandomAnimalPenalty()),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 2, trackingScore * 2 + 3, new RewardImpl.FoodPenalty(25,
                                                                                                                                                     "The quicksand nearly killed you and claimed some of your supplies.  You lost 25 food.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 2 + 3, int.MaxValue, new RewardImpl.FoodReward(foodReward, foodString))
        };

        List <ExplorationCriteria> variableRescueReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, trackingScore * 3, new RewardImpl.RandomAnimalPenalty()),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 3, trackingScore * 3 + 3, new RewardImpl.FoodPenalty(25,
                                                                                                                                                     "The quicksand nearly killed you and claimed some of your supplies.  You lost 25 food.")),
            new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), trackingScore * 3 + 3, int.MaxValue, new RewardImpl.AnimalReward(animalReward, tameString))
        };


        e.options.Add(new ExplorationEvent.Option("Your animals are hungry.  Let's try to get some meat.", variableFoodReward));
        e.options.Add(new ExplorationEvent.Option("The " + species.ToString() + " look like great new travel companions. Maybe if we rescue them, they will join our cause?", variableRescueReward));
        e.options.Add(new ExplorationEvent.Option("Do Nothing.",
                                                  new ExplorationCriteria(TraitFactory.Attribute.Tracking.ToString(), int.MinValue, int.MaxValue, new RewardImpl.DoNothingReward())
                                                  ));

        return(e);
    }
示例#22
0
    public AnimalDef Evolved()
    {
        AnimalDef evolved = new AnimalDef(EvolvedType(m_animalType), m_colour);

        return(evolved);
    }
示例#23
0
 public AnimalReward(AnimalDef animal)
 {
     animals.Add(animal);
 }
示例#24
0
 public Animal(Vector2Int position, AnimalDef def) : base(position, def)
 {
 }
示例#25
0
 /// Instantiate an human object
 public Human(Vector2Int position, AnimalDef def) : base(position, def)
 {
     this.humanSkin = new HumanSkin(this);
     this.movement.onChangeDirection += this.humanSkin.UpdateLookingAt;
 }