예제 #1
0
        /// <summary>
        /// Move this instance. May be overriden in inheriting classes.
        /// </summary>
        public virtual Vec3 Move()
        {
            // HAndle null?
            if (!Exists)
            {
                return(Vec3.Zero);
            }

            // Empty jetPosition means x, y and z are all 0.
            if (this is ProjectileBase)
            {
                if (!_isVelocitySet)
                {
                    if (PhysicalEntity != null)
                    {
                        var peASV = new pe_action_set_velocity();
                        peASV.v = Speed;
                        PhysicalEntity.Action(peASV);
                    }
                    _isVelocitySet = true;
                }
                return(Position);
            }

            Vec3 newPosition = Position + FrameTime.Normalize(Speed);

            Position = newPosition;
            return(newPosition);
        }
예제 #2
0
        /*returns the most specific location common to both entities
         * first find lowest common ancestor using LCA algorithm:
         * first save the paths from the root node to each entity.
         * second compare paths node by node, starting at root
         * when the paths are no longer the same, they have diverged and lowest common ancestor was reached
         *
         * now having found the LCA, return the path from there to entityB
         */
        public PhysicalEntity[] getLocationARelativeToB(PhysicalEntity entityA, PhysicalEntity entityB)
        {
            ArrayList pathAtoRoot = new ArrayList();
            ArrayList pathBtoRoot = new ArrayList();

            pathAtoRoot.Add(entityA);
            pathBtoRoot.Add(entityB);

            while (((PhysicalEntity)pathAtoRoot[pathAtoRoot.Count - 1]).hasSpatialParent())
            {
                pathAtoRoot.Add(((PhysicalEntity)pathAtoRoot[pathAtoRoot.Count - 1]).getSpatialparent().adult);
            }

            while (((PhysicalEntity)pathBtoRoot[pathBtoRoot.Count - 1]).hasSpatialParent())
            {
                pathBtoRoot.Add(((PhysicalEntity)pathBtoRoot[pathBtoRoot.Count - 1]).getSpatialparent().adult);
            }

            //while the nodes are the same, keep popping off the head node
            //NOTE: will break if they dont share common ancestor
            while ((pathAtoRoot.Count != 0 && pathBtoRoot.Count != 0) && ((PhysicalEntity)pathAtoRoot[pathAtoRoot.Count - 1]).Equals(((PhysicalEntity)pathBtoRoot[pathBtoRoot.Count - 1])))
            {
                pathAtoRoot.RemoveAt(pathAtoRoot.Count - 1);
                pathBtoRoot.RemoveAt(pathBtoRoot.Count - 1);
            }
            //return B, unles A is 0
            if (pathAtoRoot.Count == 0)
            {
                return((PhysicalEntity[])pathBtoRoot.ToArray(typeof(PhysicalEntity)));
            }
            else
            {
                return((PhysicalEntity[])pathBtoRoot.ToArray(typeof(PhysicalEntity)));
            }
        }
        /*tells the location of an object, pragmatically taking into account the location of the conversation
         * 1)the x is in spatialGrandparent, in spatialParent
         */
        public String senseTellAboutWhere(String utterer, PhysicalEntity entitySubject, PhysicalEntity conversationLocation)
        {
            String subject, preposition, spatialParent;
            String output = "";

            subject = renderConstituent(entitySubject, false);



            PhysicalEntity[] path = world.getLocationARelativeToB(conversationLocation, entitySubject);

            /*at this point we have the direct path from the lowest common ancestor to the subject
             * now we will render that into a string*/
            if (path.Length <= 2)
            {
                return("this is " + subject);
            }

            int count = path.Length - 2;

            while (count > 0)
            {
                output += " " + path[count].getSpatialparent().preposition.ToString() + " " + renderConstituent(path[count], false);
                count--;
            }

            //assemble output
            output = subject + " is " + output;

            return(output);
        }
예제 #4
0
        public GameEntity Spawn(World world, Position pos = null)
        {
            Utils.Log("Spawning template: " + tagsAsText);
            GameEntity     result  = Activator.CreateInstance(entityToSpawn) as GameEntity;
            PhysicalEntity physEnt = result as PhysicalEntity;

            if (physEnt != null)
            {
                world.AddEntity(physEnt);
                physEnt.PlaceNear(pos);
            }

            ApplyValues(result);

            foreach (Property subComp in subComponents)
            {
                int qtdToSpawn = subComp.CalcQtyToSpawn();
                for (int i = 0; i < qtdToSpawn; i++)
                {
                    SpawnSubComponent(world, pos, result, subComp);
                }
            }
            result.Initialize();
            return(result);
        }
예제 #5
0
 public PhysicalEntity AddEntity(PhysicalEntity entity)
 {
     if (entities.Contains(entity))
     {
         Utils.LogError("Entities already contains " + entity);
     }
     entities.Add(entity);
     return(entity);
 }
 //sets default/random values for anything the user doesnt specify
 private void autoFillUnspecifiedParamaters()
 {
     //if no location was specified, simply guess that the conversation is probably taking place where the participants are
     //assumption only holds true if the user has been keeping the knowledge database up to date
     if (conversationLocation == null)
     {
         conversationLocation = participantOne.getSpatialparent().adult;
     }
 }
예제 #7
0
        //e.g. (john gets) down the book from the high shelf for Mary quickly
        public void setDiTransitive(String object_one_preposition, PhysicalEntity object_one, String object_two_preposition, PhysicalEntity object_two, String object_two_adverb)
        {
            this.object_one_preposition = object_one_preposition;
            this.object_one             = object_one;

            this.object_two_preposition = object_two_preposition;
            this.object_two             = object_two;

            this.object_two_adverb = object_two_adverb;
        }
예제 #8
0
    public override void _Ready()
    {
        bot          = (PhysicalEntity)GetParent();
        frontSensor  = (RayCast)GetNode("Sensors/Front");
        this.destroy = (AudioStreamPlayer3D)GetNode("SfxDestroy");
        this.detect  = (AudioStreamPlayer3D)GetNode("SfxDetect");
        this.sensors = (Spatial)GetNode("Sensors");
        AudioStreamPlayer3D engine = (AudioStreamPlayer3D)GetNode("Engine");

        engine.Play();
    }
예제 #9
0
파일: Pistol.cs 프로젝트: Bigalan09/Zombies
 public Pistol(PhysicalEntity owner)
 {
     Owner = owner;
     Cooldown = 8;
     Damage = 22;
     knockEffect = 25;
     ReloadTime = 8;
     ClipSize = 10;
     numberOfBullets = 1;
     AllowFire = true;
 }
예제 #10
0
        /// <summary>
        /// Gives this entity physical properties.
        /// </summary>
        /// <param name="parameters">
        /// A set of parameters that describe physical properties of the entity.
        /// </param>
        public void Physicalize(PhysicalizationParams parameters)
        {
            this.AssertObjectValidity();

            Native.PhysicsInterop.Physicalize(this.Handle, parameters);

            this.Physics =
                parameters.type == PhysicalizationType.None
                                ? null
                                : PhysicalEntity.TryGet(Native.PhysicsInterop.GetPhysicalEntity(this.Handle));
        }
예제 #11
0
        //returns an array of the tostring of every physical entity
        public String[] getAllphysicalEntitiesToString()
        {
            object[] objectarray = worldArray.ToArray();
            String[] stringarray = new String[objectarray.Length];

            for (int i = objectarray.Length - 1; i >= 0; i--)
            {
                PhysicalEntity pe = (PhysicalEntity)objectarray[i];
                stringarray[i] = pe.ToString();
            }
            return(stringarray);
        }
예제 #12
0
        public OperationResult AddPhysicalEntity(PhysicalEntity client)
        {
            var result = OperationResult.CreateWithSuccess();

            using (var context = new StoreCoreContext())
            {
                var newEntity = context.inf_physical_entity.FirstOrDefault(f => f.client_id == client.ClientId && f.record_state != 1);

                if (newEntity != null)
                {
                    return(OperationResult.CreateWithError("Account is exist!"));
                }

                else
                {
                    var address = context.inf_address.FirstOrDefault(f => f.client_id == client.ClientId && f.record_state != 1);

                    if (address != null)
                    {
                        return(OperationResult.CreateWithError("Address is exist!"));
                    }

                    var dbAddress = context.inf_address.Create();

                    dbAddress.client_id      = client.ClientId;
                    dbAddress.country        = client.Address.Country;
                    dbAddress.city           = client.Address.City;
                    dbAddress.street         = client.Address.Street;
                    dbAddress.home_number    = client.Address.HomeNumber;
                    dbAddress.creation_date  = DateTime.UtcNow;
                    dbAddress.record_updated = DateTime.UtcNow;
                    dbAddress.record_state   = 0;

                    context.inf_address.Add(dbAddress);
                    context.SaveChanges();

                    var dbClient = context.inf_physical_entity.Create();

                    dbClient.client_id       = client.ClientId;
                    dbClient.date_of_birth   = client.DateOfBirth;
                    dbClient.passport_number = client.PassportNumber;
                    dbClient.address         = dbAddress.id;
                    dbClient.creation_date   = DateTime.UtcNow;
                    dbClient.record_updated  = DateTime.UtcNow;
                    dbClient.record_state    = 0;

                    context.inf_physical_entity.Add(dbClient);
                    context.SaveChanges();
                }
            }
            return(result);
        }
예제 #13
0
        public void Physicalize(PhysicalizationParams physicalizationParams)
        {
            NativePhysicsMethods.Physicalize(this.GetIEntity(), physicalizationParams);

            if (physicalizationParams.type == PhysicalizationType.None)
            {
                _physics = null;
            }
            else
            {
                _physics = PhysicalEntity.TryGet(NativePhysicsMethods.GetPhysicalEntity(EntityHandle));
            }
        }
예제 #14
0
        public ActionResult UnLegalRepresentative(int?physicalEntityPK)
        {
            IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);

            if (physicalEntityPK != null)
            {
                PhysicalEntity physicalEntity = physicalEntitiesRepository.GetPhysicalEntityByPK((int)physicalEntityPK);

                physicalEntity.LegalRepresentative = false;

                physicalEntitiesRepository.SaveChanges();
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
예제 #15
0
        public ActionResult Owner(int?physicalEntityPK)
        {
            IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);

            if (physicalEntityPK != null)
            {
                PhysicalEntity physicalEntity = physicalEntitiesRepository.GetPhysicalEntityByPK((int)physicalEntityPK);

                physicalEntity.Owner = true;

                physicalEntitiesRepository.SaveChanges();
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
예제 #16
0
        public void ConvertTo(PhysicalEntityView physicalEntityView, PhysicalEntity physicalEntity)
        {
            physicalEntity.PhysicalEntityPK = physicalEntityView.PhysicalEntityPK;

            physicalEntity.Firstname     = physicalEntityView.Firstname;
            physicalEntity.Lastname      = physicalEntityView.Lastname;
            physicalEntity.Gender        = physicalEntityView.Gender;
            physicalEntity.OIB           = physicalEntityView.OIB;
            physicalEntity.JMBG          = physicalEntityView.JMBG;
            physicalEntity.DateOfBirth   = physicalEntityView.DateOfBirth;
            physicalEntity.CitizenshipFK = physicalEntityView.CitizenshipFK;

            physicalEntity.BirthCountryFK       = physicalEntityView.BirthCountryFK;
            physicalEntity.BirthCountyFK        = physicalEntityView.BirthCountyFK;
            physicalEntity.BirthCityCommunityFK = physicalEntityView.BirthCityCommunityFK;
            physicalEntity.BirthPlace           = physicalEntityView.BirthPlace;

            physicalEntity.ResidenceCountryFK       = physicalEntityView.ResidenceCountryFK;
            physicalEntity.ResidenceCountyFK        = physicalEntityView.ResidenceCountyFK;
            physicalEntity.ResidenceCityCommunityFK = physicalEntityView.ResidenceCityCommunityFK;
            physicalEntity.ResidencePostalOfficeFK  = physicalEntityView.ResidencePostalOfficeFK;
            physicalEntity.ResidencePlaceFK         = physicalEntityView.ResidencePlaceFK;
            physicalEntity.ResidencePlace           = physicalEntityView.ResidencePlace;
            physicalEntity.ResidenceStreetName      = physicalEntityView.ResidenceStreetName;

            physicalEntity.IdentityCardNumber           = physicalEntityView.IdentityCardNumber;
            physicalEntity.IdentityCardDateOfIssue      = physicalEntityView.IdentityCardDateOfIssue;
            physicalEntity.IdentityCardRegionalOfficeFK = physicalEntityView.IdentityCardRegionalOfficeFK;
            physicalEntity.IdentityCardDateTillValid    = physicalEntityView.IdentityCardDateTillValid;

            physicalEntity.PassportNumber           = physicalEntityView.PassportNumber;
            physicalEntity.PassportDateOfIssue      = physicalEntityView.PassportDateOfIssue;
            physicalEntity.PassportDateTillValid    = physicalEntityView.PassportDateTillValid;
            physicalEntity.PassportCountryOfIssueFK = physicalEntityView.PassportCountryOfIssueFK;
            physicalEntity.PassportPlaceOfIssue     = physicalEntityView.PassportPlaceOfIssue;

            physicalEntity.ReferentRegionalOfficeFK = physicalEntityView.ReferentRegionalOfficeFK;
            physicalEntity.ReferentSubstationFK     = physicalEntityView.ReferentSubstationFK;

            physicalEntity.Owner = physicalEntityView.Owner;
            physicalEntity.LegalRepresentative = physicalEntityView.LegalRepresentative;
            physicalEntity.Referent            = physicalEntityView.Referent;

            physicalEntity.ChangeDate = physicalEntityView.ChangeDate;

            physicalEntity.Deleted = physicalEntityView.Deleted;
        }
예제 #17
0
        public ActionResult Delete(int?physicalEntityPK)
        {
            IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);

            if (physicalEntityPK != null)
            {
                PhysicalEntity physicalEntity = physicalEntitiesRepository.GetPhysicalEntityByPK((int)physicalEntityPK);

                physicalEntity.Deleted = true;

                physicalEntitiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", physicalEntity.PhysicalEntityPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
예제 #18
0
        public ActionResult Edit(int?physicalEntityPK)
        {
            if (physicalEntityPK != null)
            {
                IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);
                PhysicalEntity     physicalEntity     = physicalEntitiesRepository.GetPhysicalEntityByPK((int)physicalEntityPK);
                PhysicalEntityView physicalEntityView = new PhysicalEntityView();

                physicalEntityView.ConvertFrom(physicalEntity, physicalEntityView);
                physicalEntityView.BindDDLs(physicalEntityView, db);

                return(View(physicalEntityView));
            }
            else
            {
                return(RedirectToAction("Index", "PhysicalEntity"));
            }
        }
예제 #19
0
파일: PlayerLabel.cs 프로젝트: tcmug/spacey
    // Called when the node enters the scene tree for the first time.
    public override void _Process(float delta)
    {
        t += delta;
        GetNode <Label>("Text").Visible = ((t * 1000) % 500) > 250;
        PhysicalEntity player = GetTree().GetRoot().GetNode <PhysicalEntity>("Spatial/Player");
        Spatial        target = player.GetLockedOnTarget();

        if (target != null)
        {
            Vector3      point = target.GetGlobalTransform().origin;
            Godot.Camera cam   = GetTree().GetRoot().GetCamera();
            if (cam == null)
            {
                return;
            }
            float distance = player.GetGlobalTransform().origin.DistanceTo(point);
            if (distance >= 1000)
            {
                distance /= 1000;
                GetNode <Label>("Distance").SetText(string.Format("{0:0.0}km", distance));
            }
            else
            {
                GetNode <Label>("Distance").SetText(string.Format("{0:0}m", distance));
            }
            if (!cam.IsPositionBehind(point))
            {
                Viewport vp   = cam.GetViewport();
                Vector2  pos  = cam.UnprojectPosition(point);
                Viewport vp2d = GetViewport();
                Vector2  posx = new Vector2(
                    pos.x / (vp.GetSize().x / vp2d.GetSize().x),
                    pos.y / (vp.GetSize().y / vp2d.GetSize().y)
                    );
                this.SetPosition(posx);
                this.Visible = true;
            }
            else
            {
                this.Visible = false;
            }
        }
    }
예제 #20
0
        public ActionResult Edit(PhysicalEntityView physicalEntityView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);
                PhysicalEntity physicalEntity = physicalEntitiesRepository.GetPhysicalEntityByPK((int)physicalEntityView.PhysicalEntityPK);
                physicalEntityView.ConvertTo(physicalEntityView, physicalEntity);

                physicalEntitiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", physicalEntity.PhysicalEntityPK);

                return(RedirectToAction("Index", "PhysicalEntity"));
            }
            else
            {
                physicalEntityView.BindDDLs(physicalEntityView, db);

                return(View(physicalEntityView));
            }
        }
예제 #21
0
        public void UpdatePhysicalClient(PhysicalEntity client)
        {
            using (var context = new StoreCoreContext())
            {
                var dbClient       = context.inf_client.FirstOrDefault(f => f.id == client.ClientId && f.record_state != 1);
                var dbAddress      = context.inf_address.FirstOrDefault(f => f.client_id == client.ClientId && f.record_state != 1);
                var dbPhysicalItem = context.inf_physical_entity.FirstOrDefault(f => f.client_id == client.ClientId && f.record_state != 1);

                if (dbPhysicalItem != null)
                {
                    dbPhysicalItem.passport_number = client.PassportNumber;
                    dbPhysicalItem.date_of_birth   = client.DateOfBirth;
                    dbPhysicalItem.record_state    = 2;
                    dbPhysicalItem.record_updated  = DateTime.UtcNow;

                    context.SaveChanges();
                }

                if (dbClient != null)
                {
                    dbClient.name           = client.Name;
                    dbClient.record_state   = 2;
                    dbClient.record_updated = DateTime.UtcNow;

                    context.SaveChanges();
                }

                if (dbAddress != null)
                {
                    dbAddress.country        = client.Address.Country;
                    dbAddress.city           = client.Address.City;
                    dbAddress.street         = client.Address.Street;
                    dbAddress.home_number    = client.Address.HomeNumber;
                    dbAddress.record_state   = 2;
                    dbAddress.record_updated = DateTime.UtcNow;

                    context.SaveChanges();
                }
            }
        }
예제 #22
0
 public PhysicalStatus(PhysicalEntity physEnt)
 {
     PhysicalEntity = physEnt;
 }
예제 #23
0
 public int add(PhysicalEntity k)//TODO definitely need a better ID function. e.g. once that actually gives unique id codes and one that always gives the same object the same ID
 {
     worldArray.Add(k);
     k.ID = k.GetHashCode() /*k.nodeName + r.NextDouble().ToString()*/;
     return(k.ID);//now the game has a copy of the ID used to identify this object
 }
        //TODO add optional second preposition, i.e. make this bidirectional

        public SpatialLocation(PhysicalEntity c, Preposition p1, PhysicalEntity a)
        {
            child       = c;
            preposition = p1;
            adult       = a;
        }
        /*FUNCTION DESCRIPRION ASK ABOUT FACTS (ask about descriptors)
         * Paramaters expects either a type or a specfici object. plus an enum adjective
         *
         * Asking about facts of a given object
         * 1)Aux + NP + Adj   "is it nice?", are they nice?, are cakes nice?
         * 2)AUX + Pr + Adj NP? "is it a tasty apple?"
         * 3)Aux + NP + verb   "Does it taste nice?" (constraints: not future tense, has verb)
         */
        public String senseAskAboutFacts(String utterer, PhysicalEntity o, Descriptor d, Tense t)
        {
            String aux, np, pr, adj, verb = "";
            int    productionRule;
            String constituent;
            String output;

            /*CHOOSE PRODUCTION RULE*/
            if (t == Tense.future || d.verb.CompareTo("is") == 0 /*ie descriptor has no special verb*/) //exclude rule 3 based on constraints
            {
                productionRule = r.Next(1, 1 /*make it 3 to allow pronouns rule*/);                     //excludes rule 3
            }
            else //tense != future
            {
                productionRule = r.Next(1, 4);
            }

            /*CHOOSE ADJECTIVE*/
            adj = d.trait.ToString();

            constituent = renderConstituent(o, false);

            /*RULE 1 or 2*/
            if (productionRule == 1 || productionRule == 2)
            {
                /*CHOOSE AUX*/
                if (t == Tense.pastSimple)
                {
                    aux = "was";
                    //assumes singular: were
                }
                else if (t == Tense.future)
                {
                    if (r.NextDouble() > 0.5)//50% chance either way between going and will
                    {
                        aux = "will";
                        if (d.verb.CompareTo("is") == 0 /*see if descriptor has a special verb defined*/)
                        {
                            verb = "be";
                        }
                        else
                        {
                            verb = d.verb.ToString();
                        }
                    }
                    else
                    {
                        aux = "is";
                        if (d.verb.CompareTo("is") == 0 /*see if descriptor has a special verb or just is*/)
                        {
                            verb = "going to be";
                        }
                        else
                        {
                            verb = "going to " + d.verb.ToString();
                        }
                    }
                }
                else /*t == Tense.present*/
                {
                    aux = "is";
                    //assumes singular: are
                }


                if (t == Tense.future)
                {
                    output = aux + " " + constituent + verb + " " + adj + "?";
                }
                else
                {
                    if (productionRule == 1)
                    {
                        output = aux + " " + constituent + " " + adj + "?";
                    }
                    else /*Production rule 2*/
                    {
                        output = aux + " " + constituent + " " + adj + "?";
                    }
                }

                //return aux + pr + adj + np
            }
            else //RULE 3
            {
                //3)Aux + Pr + verb   "Does it taste nice?"

                if (t == Tense.pastSimple)
                {
                    aux = "did";
                }
                else //tense == present
                {
                    aux = "does";
                }
                //assumes singular: do

                /*CHOOSE VERB*/
                verb = d.verb.ToString();

                output = aux + " " + constituent + " " + verb + " " + adj + "?";
            }

            //remove duplicate whitespace
            output = System.Text.RegularExpressions.Regex.Replace(output, @" {2,}", " ");

            //capitalise first letter
            output = char.ToUpper(output[0]) + output.Substring(1);

            return(output);
        }
        /*give compliment sense
         * could be complimenting:
         *  appearance of the interlocutor (entity to compliment is the interlocutor)
         *  ability of the interlocutor (something madeby/done by interlocutor)
         *  thing owned or made or chosen by the interlocutor (something owned by interlocutor)
         *
         * e.g. the cake is so good! (which you made)
         * e.g. you make great cakes! you make cakes well
         * e.g. your dog is so good!
         * e.g. you look good today!
         *
         * TODO: I like your scarf
         */
        public string sense_compliment_give(PairParamaters q, ConversationalParamaters conversationalParamaters, PhysicalEntity entityToCompliment)
        {
            String output           = "";
            String libraryDirectory = "compliments";

            //check whether we're complimenting a thing or a person
            if (entityToCompliment == q.respondingSpeaker)
            {
                libraryDirectory += "/person";
                //TODO check if its a man and woman etc.
                //TODO check if they're in love
                output = "you look good today";
            }
            else
            {
                //TODO check what the relationship is. e.g. does the interlocutor own it or did he/she make it
                //output = the/your thingToCompliment.noun is good
                //output = you thingToCompliment.verbOrigin really well (you bake cakes really well)
                output = "the " + entityToCompliment.getRandomCommonNoun() + "is really good";
            }

            /*
             * if (conversationalParamaters.registerType == ConversationalParamaters.RegisterType.formal_register)
             * {
             *  output = vocabDictionary.generateRandom(libraryDirectory + "/formal");
             *
             *  //% chance of using the interlocutors name
             *  if (conversationalParamaters.r.Next(3, 7) <= q.politeness)//greater the politeness the greater the chance of using their name/honorific
             *      output += " ," + senseThanks(q.respondingSpeaker.name(q.initiatingSpeaker));
             * }
             * else if (conversationalParamaters.registerType == ConversationalParamaters.RegisterType.casual_register)
             * {
             *  output = vocabDictionary.generateRandom(libraryDirectory + "/casual");
             * }
             * else if (conversationalParamaters.registerType == ConversationalParamaters.RegisterType.intimate_register)
             * {
             *  output = vocabDictionary.generateRandom(libraryDirectory + "/intimate");
             * }
             *
             * //50% chance of using other persons name/title
             * if (r.NextDouble() > 0.5f)
             *  output += " " + q.respondingSpeaker.name(q.initiatingSpeaker);
             *
             * //50% chance of explamation point
             * if (r.NextDouble() > 0.5f)
             *  output += "!";
             */
            return(output);
        }
        /*helper function renders noun constituent
         * this function does two things
         * first checks what for the noun should be, e.g. plural uncountable
         * second checks what type of determiner should have, e.g. a/an/some/any
         */
        private String renderConstituent(object o, bool plural)
        {
            String output;

            //check whether its a type or an entity
            Type type = o.GetType();

            if (type == typeof(PhysicalEntity))
            {
                PhysicalEntity e = (PhysicalEntity)o;

                //first check whether itshould be a pronoun
                //todo, and if so what the pronoun should be
                //output = "it";//your, my, their, she, he, him
                //TODO add in other pronouns (yours, this, that, they etc.)


                /*CHOOSE NOUN*/


                if (e.hasProperNoun)//if it has a proper name, use it
                {
                    output = e.properNoun;
                }
                else
                {
                    Noun nounObject = e.getRandomCommonNoun();
                    output = "the" + nounObject.noun;

                    if (plural && nounObject.countable)
                    {
                        output = "the " + nounObject.plural;
                    }
                }
            }
            else if (type == typeof(TypeDefinition))
            {
                TypeDefinition t = (TypeDefinition)o;

                //first check whether itshould be a pronoun
                //todo, and if so what the pronoun should be
                //output = "it";//your, my, their, she, he, him
                //TODO add in other pronouns (yours, this, that, they etc.)


                /*CHOOSE NOUN*/

                //if (e.hasProperNoun)//if it has a proper name, use it
                //    output = e.properNoun; a type should probably never have a proper noun unless its something like a chain store, e.g. REWE

                Noun nounObject = t.getRandomCommonNoun();
                if (!plural)
                {
                    //a horse
                    if (nounObject.countable)
                    {
                        output = LinguisticDictionary.LinguisticDictionary.getAorAN(nounObject.noun) + nounObject.noun;
                    }
                    else //not countable
                    {
                        output = "some " + nounObject.noun;
                    }
                }
                else //(plural)
                {
                    //some horse
                    if (!nounObject.countable)
                    {
                        output = "some " + nounObject.noun;
                    }
                    else //nounObject is countable
                    {
                        output = "some " + nounObject.plural;
                    }
                }
            }
            else
            {
                output = "error parsing constituent in UtteranceGenerator.cs : " + o.ToString() + " is neither a Physical Entity nor a Type Definition";
            }
            return(output);
        }
예제 #28
0
        private void newWorld()
        {
            worldManager = new WorldEngine();
            worldManager.newWorld("Hello World");


            //insert objects
            PhysicalEntity pe0;

            pe0            = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area"));
            pe0.properNoun = "Europe";
            pe0.oneOfAKind = true;
            int europe = worldManager.world.add(pe0);//int is the ID of the object


            PhysicalEntity pe;

            pe            = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("country"));
            pe.properNoun = "Germany";
            pe.oneOfAKind = true;
            pe.setSpatialParent(Preposition.@in, pe0);
            int germany = worldManager.world.add(pe);//int is the ID of the object

            PhysicalEntity pe2 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state"));

            pe2.properNoun = "LowerSaxony";
            pe2.setSpatialParent(Preposition.@in, pe);
            pe2.oneOfAKind = true;

            int lowerSaxony = worldManager.world.add(pe2);//int is the ID of the object

            PhysicalEntity pe3 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state"));

            pe3.properNoun = "Osnabrück";
            pe3.setSpatialParent(Preposition.@in, pe2);
            pe3.oneOfAKind = true;

            int osna = worldManager.world.add(pe3);//int is the ID of the object

            PhysicalEntity nrw = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state"));

            nrw.properNoun = "North Rhine Westfalia";
            nrw.setSpatialParent(Preposition.@in, pe2);
            nrw.oneOfAKind = true;

            int nrwInt = worldManager.world.add(nrw);//int is the ID of the object

            PhysicalEntity pe4 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area"));

            pe4.properNoun = "Westerberg Campus";
            pe4.setSpatialParent(Preposition.@in, pe3);
            pe4.oneOfAKind = true;

            int westerberg = worldManager.world.add(pe4);//int is the ID of the object

            PhysicalEntity pe5 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area"));

            pe5.properNoun = "Schloss Campus";
            pe5.setSpatialParent(Preposition.@in, pe3);//in osnabrueck
            pe5.oneOfAKind = true;

            int schloss = worldManager.world.add(pe5);//int is the ID of the object

            PhysicalEntity pe6 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area"));

            pe6.properNoun = "Mensa";
            pe6.setSpatialParent(Preposition.@on, pe4);
            pe6.oneOfAKind = false;

            int mensa = worldManager.world.add(pe6);//int is the ID of the object

            PhysicalEntity pe7 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("banana"));

            //pe4.properNoun = "Westerberg Campus";
            pe7.setSpatialParent(Preposition.@in, pe6);
            pe7.oneOfAKind = true;

            int banana = worldManager.world.add(pe7);//int is the ID of the object

            PhysicalEntity pe8 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("coffee"));

            //pe4.properNoun = "Westerberg Campus";
            pe8.setSpatialParent(Preposition.@in, pe6);
            pe8.oneOfAKind = true;

            int coffee = worldManager.world.add(pe8);//int is the ID of the object

            PhysicalEntity pe9 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("mango"));

            //pe4.properNoun = "Westerberg Campus";
            pe9.setSpatialParent(Preposition.@in, pe6);
            pe9.oneOfAKind = true;

            int mango = worldManager.world.add(pe9);//int is the ID of the object

            PhysicalEntity pe10 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("banana"));

            //pe4.properNoun = "Westerberg Campus";
            pe10.setSpatialParent(Preposition.@in, pe6);
            pe10.oneOfAKind = true;

            int banana2 = worldManager.world.add(pe10);//int is the ID of the object

            PhysicalEntity pe11 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("bar"));

            pe11.properNoun = "Sauber von Oz";
            pe11.setSpatialParent(Preposition.@in, worldManager.world.findByProperNoun("Osnabrück"));
            pe11.oneOfAKind = true;

            int svo = worldManager.world.add(pe10);//int is the ID of the object

            PhysicalEntity pe12 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("beer"));

            //pe11.properNoun = "Sauber von Oz";
            pe11.setSpatialParent(Preposition.@in, pe11);
            pe11.oneOfAKind = true;

            int thingy = worldManager.world.add(pe12);//int is the ID of the object

            PhysicalEntity_Agent pe13 = new PhysicalEntity_Agent(worldManager.typeDictionary.tryGetValue("human"), "John", "Snow", PhysicalEntity_Agent.Gender.male);

            //pe11.properNoun = "Sauber von Oz";
            pe11.setSpatialParent(Preposition.on, pe4);
            pe11.oneOfAKind = true;

            int agent1 = worldManager.world.add(pe13);//int is the ID of the object

            PhysicalEntity_Agent pe14 = new PhysicalEntity_Agent(worldManager.typeDictionary.tryGetValue("human"), "Mary", "Jane", PhysicalEntity_Agent.Gender.female);

            //pe11.properNoun = "Sauber von Oz";
            pe11.setSpatialParent(Preposition.on, pe4);
            pe11.oneOfAKind = true;

            int agent2 = worldManager.world.add(pe14);//int is the ID of the object

            /*END adding objects*/

            worldManager.saveWorldFile();
            loadWorld();
        }
예제 #29
0
파일: Status.cs 프로젝트: nbrien/CryMono
 public PhysicalStatus(PhysicalEntity physEnt)
 {
     PhysicalEntity = physEnt;
 }
예제 #30
0
    public override void _PhysicsProcess(float delta)
    {
        Node parent = GetParent();

        if (aimingRay.IsColliding())
        {
            Vector3 cpoint = ToLocal(aimingRay.GetCollisionPoint());
            aimingSight.Translation = cpoint;
            aimingSight.Visible     = true;
        }
        else
        {
            aimingSight.Visible = false;
        }

        if (parent != null)
        {
            PhysicalEntity entity = (PhysicalEntity)parent;

            Vector3 force = new Vector3(0, 0, 0);

            if (Input.IsActionJustPressed("fire"))
            {
                var ent = get_object_under_mouse();
                if (IsInstanceValid(ent))
                {
                    if (IsInstanceValid(target))
                    {
                        target.Deselect();
                    }
                    target = ent;
                    target.Select();
                    (GetParent() as PhysicalEntity).LockOn(ent);
                }
                else
                {
                    (GetParent() as PhysicalEntity).LockOn(null);
                    if (IsInstanceValid(target))
                    {
                        target.Deselect();
                    }
                    target = null;
                }
            }

            if (target != null)
            {
                entity.Engage();
            }

            if (Input.IsActionPressed("fire"))
            {
                entity.Engage();
            }

            if (Input.IsActionPressed("move_forward"))
            {
                force.z += 1;
            }

            if (Input.IsActionPressed("move_backward"))
            {
                force.z += -1;
            }

            if (Input.IsActionPressed("move_left"))
            {
                force.x += 1;
            }

            if (Input.IsActionPressed("move_right"))
            {
                force.x += -1;
            }

            entity.boost(force);

            if (Input.IsActionPressed("rotate_left"))
            {
                torque.z += -1;
            }

            if (Input.IsActionPressed("rotate_right"))
            {
                torque.z += 1;
            }
            Vector3 ret = torque;
            torque = new Vector3();
            entity.turn(ret);
        }
    }
예제 #31
0
 public Ownership(PhysicalEntity p1, PhysicalEntity p2)
 {
     owner = p1;
     owned = p2;
 }
예제 #32
0
 public Opinion(PhysicalEntity_Agent opiner, PhysicalEntity subject)
 {
     this.opiner   = opiner;
     subjectEntity = subject;
 }