Ejemplo n.º 1
0
 public bool AllowEventType(List <RoleType> roleTypes, AgentEventType agentEventType, bool forCreating)
 {
     foreach (EventTypePermission eventTypePermission in eventTypePermissions)
     {
         if (agentEventType == eventTypePermission.agentEventType && roleTypes.Contains(eventTypePermission.roleType))
         {
             if (forCreating)
             {
                 if (eventTypePermission.canBeCreator)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 if (eventTypePermission.canBeAttendee)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
         }
     }
     // If AgentEventType/Role combo is not in permissions then don't allow it
     Debug.Log("Unable to find explicit agent event type permission in faction - denying permission to create event.");
     return(false);
 }
Ejemplo n.º 2
0
        private new void Awake()
        {
            base.Awake();
            timeManager    = GameObject.Find("TimeManager").GetComponent <TimeManager>();
            agentEventType = (AgentEventType)entityType;
            travellingTo   = new List <Agent>();

            // TODO: Should AgentEvent have all of the Entity stuff?
            ResetEntity();
        }
Ejemplo n.º 3
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            AgentEventType agentEventType = outputChange.entityType as AgentEventType;

            Vector3 position = target.transform.position;

            if (agentEventType.prefabVariants == null || agentEventType.prefabVariants.Count == 0)
            {
                Debug.LogError(agent.name + ": CreateAgentEventOCT: " + agentEventType.name + " has no Prefab Variants.  Please Fix.");
                return(false);
            }
            GameObject newGameObject = agentEventType.CreateEntity(0, position, agentEventType.prefabVariants[0].transform.rotation,
                                                                   agentEventType.prefabVariants[0].transform.localScale, agent);

            AgentEvent agentEvent = newGameObject.GetComponent <AgentEvent>();

            mapping.target = agentEvent;
            agentEvent.AddAttendee(agent);
            return(true);
        }