Beispiel #1
0
        public void SetOrientation(AgentOrientation orientation)
        {
            switch (orientation)
            {
            case AgentOrientation.FacingLeft:
                if (textureTopLeft != null)
                {
                    ActiveTexture = textureTopLeft;
                }
                break;

            case AgentOrientation.FacingDown:
                if (textureBottomLeft != null)
                {
                    ActiveTexture = textureBottomLeft;
                }
                break;

            case AgentOrientation.FacingUp:
                if (textureBottomRight != null)
                {
                    ActiveTexture = textureBottomRight;
                }
                break;

            case AgentOrientation.FacingRight:
                if (textureTopRight != null)
                {
                    ActiveTexture = textureTopRight;
                }
                break;
            }
        }
 public MobileAgent(TimeSpan birthTime, string name, TextureBook textureBook, Vector startingPosition, Vector startingSpeed, AgentOrientation orientation)
     : base(birthTime, name, startingPosition)
 {
     Activity         = AgentActivity.Unknown;
     Speed            = startingSpeed;
     this.textureBook = textureBook;
     Orientation      = orientation;
 }
Beispiel #3
0
 void OnLevelWasLoaded(int level)
 {
     if (!this.Initialized)
     {
         return;
     }
     back_prop_actions     = new List <AgentAction>();
     last_observed_actions = new List <AgentAction>();
     last_observed_dex     = -1;
     if (orientation == AgentOrientation.Listening)
     {
         orientation = AgentOrientation.Watching;
     }
     NextCachedAttemptOnLevel(SceneManager.GetActiveScene().name);
     ready = true;
 }
Beispiel #4
0
        public override IEnumerator Initialize()
        {
            string connString = ConnString;

            conn = new MySqlConnection(connString);
            CacheUserList();
            CacheUserLogs();

            this.orientation = AgentOrientation.Watching;

            this.initialized = true;

            //TODO - I think...?
            ready = true;
            yield break;
        }
Beispiel #5
0
        private void ProcessRequestResponse(WWW www)
        {
            if (string.IsNullOrEmpty(www.error))
            {
                // backup the state

                JObject response = JsonConvert.DeserializeObject <JObject>(www.text);

                //If no action was returned
                if (response.Count == 0)
                {
                    switch (orientation)
                    {
                    case AgentOrientation.Watching:
                        waitingOnAPI = false;
                        return;

                    case AgentOrientation.Trying:
                        current_action_dex = last_observed_dex;
                        back_prop_actions  = last_observed_actions;
                        orientation        = AgentOrientation.Listening;
                        waitingOnAPI       = false;
                        return;

                    case AgentOrientation.Stuck:
                    case AgentOrientation.Idle:
                    case AgentOrientation.Listening:
                        Debug.LogErrorFormat("No Action Returned in {0} Orientation; this should be impossible!", orientation);
                        return;
                    }
                }
                // IF an action was returned
                else
                {
                    //Debug.LogFormat("RESPONSE: {0}",response);
                    AgentAction act = new AgentAction(response.Value <string>("selection"),
                                                      response.Value <string>("action"),
                                                      JsonConvert.SerializeObject(response["inputs"]),
                                                      null,
                                                      DateTime.Now,
                                                      CurrentUserId,
                                                      SceneManager.GetActiveScene().name,
                                                      CurrentCachedAction.Attempt,
                                                      CurrentCachedAction.SessionID,
                                                      Guid.NewGuid().ToString(),
                                                      CurrentCachedAction.AttemptID);

                    switch (orientation)
                    {
                    case AgentOrientation.Watching:
                        last_observed_actions = new List <AgentAction>(back_prop_actions);
                        last_observed_dex     = current_action_dex;
                        this.orientation      = AgentOrientation.Trying;
                        break;

                    case AgentOrientation.Trying:
                        break;

                    default:
                        Debug.LogErrorFormat("Don't know what to do with orientation {0}", orientation);
                        break;
                    }

                    this.lastAction = currAction;
                    this.currAction = act;
                    waitingOnAPI    = false;
                }
            }
        }
        public Employee(TimeSpan birthTime, string agentName, TextureBook textureBook, Vector position, AgentOrientation orientation,
                        string firstName, string lastName, DateTime birthday, Skills skills, Job job)
            : base(birthTime, agentName, textureBook, position, speed, orientation)
        {
            FirstName = firstName;
            LastName  = lastName;
            Birthday  = birthday;
            Job       = job;
            Skills    = skills;

            Necessities = new Necessities(Necessities.Rating.Full);
        }