Пример #1
0
 void Start()
 {
     size              = PlantSize.Sprout;
     timeSinceGrowth   = 0f;
     startScale        = gameObject.transform.localScale;
     maxTimesToBeEaten = Random.Range(5, 25);
 }
Пример #2
0
        public override void Initialize()
        {
            Name = "plant";
            Synonyms.Are("plant", "beanstalk", "stalk", "bean", "giant", "tiny", "little", "murmuring", "twelve", "foot", "tall", "bellowing");
            Height = PlantSize.Tiny;

            FoundIn <WestPit>();

            Describe = () =>
            {
                if (Height == PlantSize.Tiny)
                {
                    return("There is a tiny little plant in the pit, murmuring \"Water, water, ...\"");
                }
                else if (Height == PlantSize.Tall)
                {
                    return("There is a 12-foot-tall beanstalk stretching up out of the pit, bellowing \"Water!! Water!!\"");
                }

                return("There is a gigantic beanstalk stretching all the way up to the hole.");
            };

            Before <Climb>(() =>
            {
                if (Height == PlantSize.Tiny)
                {
                    Print("It's just a little plant!");
                    return(true);
                }
                else if (Height == PlantSize.Tall)
                {
                    Print("You have climbed up the plant and out of the pit.\n");
                    MovePlayer.To <WestEndOfTwoPitRoom>();
                    return(true);
                }

                Print("You clamber up the plant and scurry through the hole at the top.\n");

                MovePlayer.To <NarrowCorridor>();

                return(true);
            });

            Before <Take>(() =>
            {
                Print("The plant has exceptionally deep roots and cannot be pulled free.");
                return(true);
            });

            Before <Water>(Water);

            Before <Actions.Oil>(Water);


            //Before Examine:
            //self.describe();
            //rtrue;
        }
Пример #3
0
        public void Water()
        {
            switch (growth)
            {
            case PlantSize.SMALL:
                growth     = PlantSize.MEDIUM;
                Appearance = "There is a large imposing plant here. The top of it almost reaches the ceiling!";
                break;

            case PlantSize.MEDIUM:
                growth     = PlantSize.LARGE;
                Appearance = "There is a massive plant in here. The top of it has broken through the ceiling, and you a key dropped to the floor";
                break;
            }
        }
Пример #4
0
    private void Grow()
    {
        // Keep track of time since the last growth
        timeSinceGrowth += Time.deltaTime;

        // Once the proper time has resolved, this plant with grow
        if (timeSinceGrowth >= growthTime)
        {
            size += 1;
            gameObject.transform.localScale *= 1.5f;

            // reset timer
            timeSinceGrowth = 0f;
        }
    }
Пример #5
0
        private bool Water()
        {
            var bottle = Get <Bottle>();

            if (bottle.IsEmpty)
            {
                Print("You have nothing to water the plant with.");
                return(true);
            }

            if (bottle.Contains <OilInTheBottle>())
            {
                Remove <OilInTheBottle>();
                Print("The plant indignantly shakes the oil off its leaves and asks, \"Water?\"");
                return(true);
            }

            Remove <WaterInTheBottle>();

            var plantStickingUp = Get <PlantStickingUp>();

            switch (Height++)
            {
            case PlantSize.Tiny:
                Print("The plant spurts into furious growth for a few seconds.\n\n");
                plantStickingUp.Absent = false;
                break;

            case PlantSize.Tall:
                Print("The plant grows explosively, almost filling the bottom of the pit.\n\n");
                break;

            case PlantSize.Huge:
                Print("You've over-watered the plant! It's shriveling up! It's, it's...\n\n");
                plantStickingUp.Absent = true;
                //remove PlantStickingUp;
                Height = PlantSize.Tiny;
                break;
            }

            Describe();

            return(true);
        }
Пример #6
0
 public Plant() : base()
 {
     Appearance    = "There is a small plant in the corner of the room";
     growth        = PlantSize.SMALL;
     CanBePickedUp = false;
 }
Пример #7
0
 // When an animal eats from this plant, it will have to grow again
 public void GetEaten()
 {
     size = PlantSize.Sprout;
     gameObject.transform.localScale = startScale;
     maxTimesToBeEaten--;
 }