Esempio n. 1
0
        public static Dictionary <AgentMiscVariables, float> GetAgentMiscVariables(BASE_SPECIES species)
        {
            Dictionary <AgentMiscVariables, float> miscVariables = new Dictionary <AgentMiscVariables, float>();

            if (species == BASE_SPECIES.Gnat)
            {
                miscVariables.Add(AgentMiscVariables.Agent_Detect_Collision_Vel_Distance, 150);
                miscVariables.Add(AgentMiscVariables.Agent_Detect_Collision_Direction_Distance, 15);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Halt_Forward_Movement_If_Object_Is_Distance, 3);
                miscVariables.Add(AgentMiscVariables.Agent_Brake_If_Colliding_In, 2);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Max_Vel_Magnitude_Brake_Multiplier, 1);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Angular_Velocity_Brake_When_Over, 2);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Max_Vel_Mag_Before_Brake, 20);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Reverse_Engine_If_Colliding_In, 5);
                miscVariables.Add(AgentMiscVariables.Part_Flight_X_Engine_Kick_In_When_Faster_Than, .3f);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Y_Engine_Dist_To_Act_UP_Mult, 2);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Z_Engine_Dist_To_Act_FWD_Factor, 2);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Y_Engine_PowerDown_Until_Vel_At_Most, -.3f);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Y_Engine_PowerDown_Reduction_Factor, 10);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Maintain_Below_Velocity, .15f);
                miscVariables.Add(AgentMiscVariables.Part_Flight_Brake_When_Going_Wrong_Direction_If_Vel, 20);
                miscVariables.Add(AgentMiscVariables.MoveVar_Start_Up_Time_In_Minutes, .1f);
                miscVariables.Add(AgentMiscVariables.Agent_Is_Stuck_If_Moved_Less_Than_In_One_Sec, 10);
            }
            return(miscVariables);
        }
Esempio n. 2
0
 public static AudioClip GetCreaturePartAudioClip(BASE_SPECIES species, CreaturePart part)
 {
     if (species == BASE_SPECIES.Gnat)
     {
         if (part == CreaturePart.BRAKE)
         {
             return(RAKUtilities.getAudioClip("GnatBrake"));
         }
     }
     return(null);
 }
Esempio n. 3
0
 public static string GenerateCivName(BASE_SPECIES species)
 {
     if (species == BASE_SPECIES.Gnat)
     {
         return("Gnat Civ " + UnityEngine.Random.Range(0, 50));
     }
     else
     {
         return("No names");
     }
 }
Esempio n. 4
0
 public void SetCurrentOccupantForAllCells(BASE_SPECIES baseSpecies,
                                           string civName, bool defaults, World world)
 {
     for (int count = 0; count < cells.Length; count++)
     {
         if (cells[count].IsUnderwater)
         {
             continue;
         }
         Tribe tribe = new Tribe(1300, baseSpecies);
         cells[count].CurrentOccupants = tribe;
         world.addTribe(tribe, cells[count]);
     }
 }
Esempio n. 5
0
 private void Initialize(char gender, string speciesName, bool intelligent, BASE_SPECIES baseSpecies,
                         CONSUMPTION_TYPE consumptionType, Creature creature)
 {
     this.memory          = new Memory();
     this.speciesName     = speciesName;
     this.gender          = gender;
     this.intelligent     = intelligent;
     this.baseSpecies     = baseSpecies;
     this.consumptionType = consumptionType;
     if (intelligent)
     {
         personality = new Personality(memory, creature);
     }
     else
     {
         personality = null;
     }
 }
Esempio n. 6
0
 public static SpeciesPhysicalStats PhysicalStatsInitialize
     (BASE_SPECIES baseSpecies, Creature creature)
 {
     if (baseSpecies == BASE_SPECIES.Gnat)
     {
         return(new SpeciesPhysicalStats(
                    creature,                               // Parent creature
                    SpeciesPhysicalStats.MOVEMENT_TYPE.FLY, // Movement type
                    1,                                      // Size
                    1,                                      // Growth
                    1,                                      // Insulation
                    1,                                      // Amount of Food Required
                    10,                                     // Speed
                    1,                                      // Reproduction Rate
                    1,                                      // Gestation Time
                    10,                                     // Number Per Birth
                    1,                                      // Typical max age
                    1,                                      // Update Every in Seconds
                    10f,                                    // The distance from target before it's considered interactable
                    1));                                    // Needs to sleep after being awake for this many seconds
     }
     else if (baseSpecies == BASE_SPECIES.Gagk)
     {
         return(new SpeciesPhysicalStats(
                    creature,                               // Parent creature
                    SpeciesPhysicalStats.MOVEMENT_TYPE.FLY, // Movement type
                    10,                                     // Size
                    1,                                      // Growth
                    1,                                      // Insulation
                    1,                                      // Amount of Food Required
                    1,                                      // Speed
                    1,                                      // Reproduction Rate
                    1,                                      // Gestation Time
                    10,                                     // Number Per Birth
                    1,                                      // Typical max age
                    1,                                      // Update Every in Seconds
                    1f,                                     // The distance from target before it's considered interactable
                    1));                                    // Needs to sleep after being awake for this many seconds
     }
     else
     {
         return(null);
     }
 }
Esempio n. 7
0
        public static void CreatureAgentInitialize(BASE_SPECIES baseSpecies, CreatureAgent agent)
        {
            if (baseSpecies == BASE_SPECIES.Gnat)
            {
                agent.GetRigidBody().constraints = RigidbodyConstraints.None;
                agent.SetTurnSpeed(.3f);
                agent.SetSustainHeight(5);
                agent.SetMaxAngularVel(10);
                agent.SetMaxVelocityMagnitude(20);
                agent.SetCruisingSpeed(new Vector3(2, 1, 15));

                // Maximum force of the constant force component //
                agent.maxForce.y = 15;
                agent.maxForce.z = 8;
                agent.maxForce.x = 4;
                // Amount of force needed to hold the objects weight //
                agent.SetMinimumForceToHover(8);
                agent.SetSlowDownModifier(1);
                agent.GetRigidBody().maxAngularVelocity = 5;
                agent.SetExploreRadiusModifier(200);
                agent.SetGrabType(CreatureGrabType.TractorBeam);
                BuildCreatureParts(baseSpecies, agent);
            }
            else if (baseSpecies == BASE_SPECIES.Gagk)
            {
                agent.SetTurnSpeed(1f);
                agent.SetSustainHeight(1);
                agent.SetMaxAngularVel(15);
                agent.SetMaxVelocityMagnitude(10);
                agent.SetCruisingSpeed(new Vector3(0, 0, 5));

                // Maximum force of the constant force component //
                agent.maxForce.y = 0;
                agent.maxForce.z = 5;
                agent.maxForce.x = 0;
                // Amount of force needed to hold the objects weight //
                agent.SetMinimumForceToHover(0);
                agent.SetSlowDownModifier(15);
                agent.SetExploreRadiusModifier(200);
                BuildCreatureParts(baseSpecies, agent);
            }
        }
Esempio n. 8
0
 public Civilization(BASE_SPECIES race, string civName, bool defaults, int minPop, int maxPop)
 {
     if (defaults)
     {
         this.race    = race;
         this.civName = civName;
         members      = new Species[0];
         population   = 0;
     }
     else
     {
         this.race    = BASE_SPECIES.Gnat;
         this.civName = "DaGnats";
         members      = new Species[5];
         for (int count = 0; count < members.Length; count++)
         {
             members[count] = new Species('m', "GnatPrime", false,
                                          BASE_SPECIES.Gnat, CONSUMPTION_TYPE.OMNIVORE);
         }
         population = UnityEngine.Random.Range(minPop, maxPop);
     }
 }
Esempio n. 9
0
 public void Initialize(BASE_SPECIES baseSpecies)
 {
     rigidbody = creature.GetComponent <Rigidbody>();
     CreatureConstants.CreatureAgentInitialize(baseSpecies, this);
     if (rigidbody == null)
     {
         rigidbody = creature.GetComponentInParent <Rigidbody>();
         if (rigidbody == null)
         {
             rigidbody = creature.GetComponentInChildren <Rigidbody>();
             if (rigidbody == null)
             {
                 Debug.LogError("Can't find rigid body on " + creature.thingName);
             }
         }
     }
     rigidbody.constraints = RigidbodyConstraints.None;
     _transform            = rigidbody.transform;
     if (baseSpecies == BASE_SPECIES.Gnat)
     {
         locomotionType = CreatureLocomotionType.Flight;
     }
     else if (baseSpecies == BASE_SPECIES.Gagk)
     {
         locomotionType = CreatureLocomotionType.StandardForwardBack;
     }
     foreach (Part part in allParts)
     {
         if (part is EnginePart)
         {
             EnginePart movePart = (EnginePart)part;
             movePart.InitializeMovementPart();
         }
     }
     ignoreIncomingCollisions = false;
     initialized = true;
 }
Esempio n. 10
0
        public static Dictionary <Needs.NEEDTYPE, Need> NeedsInitialize(BASE_SPECIES baseSpecies)
        {
            Dictionary <Needs.NEEDTYPE, Need> currentNeeds = new Dictionary <Needs.NEEDTYPE, Need>();

            if (baseSpecies == BASE_SPECIES.Gnat)
            {
                currentNeeds.Add(Needs.NEEDTYPE.HUNGER, new Need(Needs.NEEDTYPE.HUNGER, .1f, false));
                currentNeeds.Add(Needs.NEEDTYPE.REPRODUCTION, new Need(Needs.NEEDTYPE.REPRODUCTION, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.SLEEP, new Need(Needs.NEEDTYPE.SLEEP, 100f, true));
                currentNeeds.Add(Needs.NEEDTYPE.TEMPERATURE, new Need(Needs.NEEDTYPE.TEMPERATURE, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.THIRST, new Need(Needs.NEEDTYPE.THIRST, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.NONE, new Need(Needs.NEEDTYPE.NONE, 0, false));
            }
            else if (baseSpecies == BASE_SPECIES.Gagk)
            {
                currentNeeds.Add(Needs.NEEDTYPE.HUNGER, new Need(Needs.NEEDTYPE.HUNGER, 1f, false));
                currentNeeds.Add(Needs.NEEDTYPE.REPRODUCTION, new Need(Needs.NEEDTYPE.REPRODUCTION, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.SLEEP, new Need(Needs.NEEDTYPE.SLEEP, 1f, true));
                currentNeeds.Add(Needs.NEEDTYPE.TEMPERATURE, new Need(Needs.NEEDTYPE.TEMPERATURE, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.THIRST, new Need(Needs.NEEDTYPE.THIRST, 1, false));
                currentNeeds.Add(Needs.NEEDTYPE.NONE, new Need(Needs.NEEDTYPE.NONE, 0, false));
            }
            return(currentNeeds);
        }
Esempio n. 11
0
        public static void BuildCreatureParts(BASE_SPECIES baseSpecies, CreatureAgent agent)
        {
            Creature    creature  = agent.creature;
            Rigidbody   rigidbody = agent.GetRigidBody();
            List <Part> allParts  = new List <Part>();

            if (baseSpecies == BASE_SPECIES.Gnat)
            {
                // Body with constant force //
                EnginePart bodyFlight = new EnginePart
                                            (CreaturePart.BODY, creature.transform.GetChild(0), CreatureLocomotionType.Flight, .2f);

                // Body with Rotation turning //
                TurnPart bodyTurning = new TurnPartRotation
                                           (CreaturePart.BODY, creature.transform.GetChild(0), CreatureTurnType.Rotate, .2f);

                // Backward Propeller //
                AnimationPart zPropeller = new AnimationPart(CreaturePart.ENGINE_Z, creature.transform.GetChild(1),
                                                             CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                             { ActionStep.Actions.Add, ActionStep.Actions.Land, ActionStep.Actions.MoveTo, ActionStep.Actions.Wait, ActionStep.Actions.Sleep },
                                                             PartMovesWith.ConstantForceZ, PartAnimationType.Movement, true);

                // Y Propellers //
                AnimationPart yPropeller = new AnimationPart(CreaturePart.ENGINE_Y, creature.transform.GetChild(3),
                                                             CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                             { ActionStep.Actions.Add, ActionStep.Actions.Land, ActionStep.Actions.MoveTo, ActionStep.Actions.Wait, ActionStep.Actions.Sleep },
                                                             PartMovesWith.ConstantForceY, PartAnimationType.Movement, true);
                AnimationPart yPropeller2 = new AnimationPart(CreaturePart.ENGINE_Y, creature.transform.GetChild(4),
                                                              CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                              { ActionStep.Actions.Add, ActionStep.Actions.Land, ActionStep.Actions.MoveTo, ActionStep.Actions.Wait, ActionStep.Actions.Sleep },
                                                              PartMovesWith.ConstantForceY, PartAnimationType.Movement, true);
                AnimationPart yPropeller3 = new AnimationPart(CreaturePart.ENGINE_Y, creature.transform.GetChild(5),
                                                              CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                              { ActionStep.Actions.Add, ActionStep.Actions.Land, ActionStep.Actions.MoveTo, ActionStep.Actions.Wait, ActionStep.Actions.Sleep },
                                                              PartMovesWith.ConstantForceY, PartAnimationType.Movement, true);
                AnimationPart yPropeller4 = new AnimationPart(CreaturePart.ENGINE_Y, creature.transform.GetChild(6),
                                                              CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                              { ActionStep.Actions.Add, ActionStep.Actions.Land, ActionStep.Actions.MoveTo, ActionStep.Actions.Wait, ActionStep.Actions.Sleep },
                                                              PartMovesWith.ConstantForceY, PartAnimationType.Movement, true);

                // Antigrav Shield //
                AntiGravityShieldPart shieldPart = new AntiGravityShieldPart(CreaturePart.SHIELD, creature.transform.GetChild(9),
                                                                             .2f, creature.GetCreatureAgent().GetRigidBody(), new ActionStep.Actions[] { ActionStep.Actions.Add,
                                                                                                                                                         ActionStep.Actions.Locate, ActionStep.Actions.None, ActionStep.Actions.Wait });
                AnimationPart antiGravShieldAnimation = new AnimationPart(CreaturePart.SHIELD, creature.transform.GetChild(7),
                                                                          CreatureAnimationMovementType.Rotation, .05f, Vector3.up, 10, new ActionStep.Actions[]
                                                                          { ActionStep.Actions.Add, ActionStep.Actions.MoveTo, ActionStep.Actions.Add, ActionStep.Actions.Eat
                                                                            , ActionStep.Actions.Locate, ActionStep.Actions.None, ActionStep.Actions.Wait },
                                                                          PartMovesWith.IsKinematic, PartAnimationType.Movement, false);

                // Tractor Beam //
                TractorBeamPart          tractorBeam      = new TractorBeamPart(creature.transform, .2f, 30);
                TractorBeamAnimationPart tractorAnimation = new TractorBeamAnimationPart(CreaturePart.TRACTORBEAM,
                                                                                         creature.transform.GetChild(8), .2f, Vector3.forward, .3f);

                allParts.Add(bodyFlight);
                allParts.Add(bodyTurning);
                allParts.Add(zPropeller);
                allParts.Add(yPropeller);
                allParts.Add(yPropeller2);
                allParts.Add(yPropeller3);
                allParts.Add(yPropeller4);
                allParts.Add(shieldPart);
                allParts.Add(antiGravShieldAnimation);
                allParts.Add(tractorBeam);
                allParts.Add(tractorAnimation);
                agent.SetCreatureTurnType(CreatureTurnType.Rotate);
                agent.setParts(allParts);
            }
            else if (baseSpecies == BASE_SPECIES.Gagk)
            {
                // Constant force for Z //
                EnginePart mainEngine = new EnginePart(CreaturePart.ENGINE_Z,
                                                       creature.transform.GetChild(0),
                                                       CreatureLocomotionType.StandardForwardBack, 1);
                TurnPart inchSpine = new TurnPartInching(CreaturePart.BODY,
                                                         creature.transform.GetChild(0),
                                                         CreatureTurnType.Inch, .5f, Direction.X,
                                                         creature.transform.GetChild(1));
                allParts.Add(mainEngine);
                allParts.Add(inchSpine);
                agent.SetCreatureTurnType(CreatureTurnType.Inch);
                agent.setParts(allParts);
            }
        }
Esempio n. 12
0
 public void Initialize(BASE_SPECIES baseSpecies)
 {
     needs        = new Needs(baseSpecies);
     _initialized = true;
 }
Esempio n. 13
0
 public Species(char gender, string speciesName, bool intelligent, BASE_SPECIES baseSpecies,
                CONSUMPTION_TYPE consumptionType, Creature creature)
 {
     Initialize(gender, speciesName, intelligent, baseSpecies, consumptionType, creature);
 }
Esempio n. 14
0
 public Tribe(int population, BASE_SPECIES race)
 {
     this.population = population;
     this.race       = race;
 }
Esempio n. 15
0
 public Needs(BASE_SPECIES baseSpecies)
 {
     currentNeeds = CreatureConstants.NeedsInitialize(baseSpecies);
 }