Ejemplo n.º 1
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
			
			AIEntityContext ec = context as AIEntityContext;
			if (ec.Owner)
			{
				bool useLeader = true;

				if (!ec.Target)
				{
					IEntity[] aryTarget = ec.GetEntityManager().Select(ec.Owner.GetPosition(), Radius, Layer);
					if (aryTarget.Length > 0) 
					{
						ec.Target = aryTarget[Random.Range(0, aryTarget.Length)];
					}

					useLeader = aryTarget.Length != 0;
				}

				if (useLeader)
				{
					ec.Leader = ec.PlayerMgr.GetPlayer();
				}
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Raises the exit event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnExit(AIContext context)
		{
			if (Index >= Children.Length)
				Children[Index-1].Stop(context);

			base.OnExit (context);
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);

			// reset current repeat count
			Repeat 	= 0;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
			
			// move to first child
			Index = Random.Range(0, Children.Length);
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnExit(AIContext context)
		{
			base.OnExit (context);

			// reset loop value
			Repeat 	= 0;
			Index 	= 0;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			while(Index < Children.Length)
			{
				Children[Index].Run(context); Index ++;
			}
			
			return BehaviourStatus.SUCCESS;
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Raises the exit event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnExit(AIContext context)
		{
			if (Index < Children.Length)
			{
				Children[Index].Stop(context);
			}
			
			base.OnExit (context);
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			AIEntityContext ec = context as AIEntityContext;
			if (!ec.Owner || !ec.Target)
				return BehaviourStatus.FAILURE;



			return BehaviourStatus.SUCCESS;
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);

			// set start time
			StartTime = Time.time;

			if (MaxWaitTime != 0)
			{
				WaitTime = Random.Range(MinWaitTime, MaxWaitTime);
			}
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			while(Index < Children.Length)
			{
				BehaviourStatus status = Children[Index].Run(context);
				if (status == BehaviourStatus.RUNNING || status == BehaviourStatus.SUCCESS)
					return status;
				
				Index ++;
			}
			
			return BehaviourStatus.FAILURE;
		}
Ejemplo n.º 11
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);

			AIEntityContext ec = context as AIEntityContext;
			if (ec.Owner && ec.Target)
			{
				// get owner character ctrl machine
				Machine = ec.Owner.GetMachine();
				if (!Machine)
					throw new System.NullReferenceException();

				if (!Machine.IsCurrentState(AITypeID.AI_BATTLE))
					Machine.ChangeState(AITypeID.AI_BATTLE);
			}
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
			
			AIEntityContext ec = context as AIEntityContext;
			if (!ec.Owner)
				throw new System.NullReferenceException ();
			
			Machine = ec.Owner.GetMachine ();
			if (!Machine)
				throw new System.NullReferenceException();

			if (!ec.Target)
			{
				FreePatrol(ec);
			}
		}
Ejemplo n.º 13
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
			
			AIEntityContext ec = context as AIEntityContext;
			if (ec.Owner && ec.Target)
			{
				// save current machine ref
				Machine = ec.Owner.GetMachine();
				if (!Machine)
					throw new System.NullReferenceException();

				float fDistance = Vector3.Distance(ec.Owner.GetPosition(), ec.Target.GetPosition());
				if (fDistance > MaxDistance)
				{
					PuesueTarget(ec.Target.GetPosition(), MaxDistance);
				}
			}
		}
Ejemplo n.º 14
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			if (Children.Length <= 0)
				return BehaviourStatus.FAILURE;

			do {
				while (Index < Children.Length) {
					BehaviourStatus status = Children [Index].Run (context);
					if (status != BehaviourStatus.RUNNING)
						Index ++;
				}

				Index = 0;
				Repeat ++;

			} while( Count == 0 ? true : Repeat < Count);

			return BehaviourStatus.SUCCESS;
		}
Ejemplo n.º 15
0
        private GameScreen Interactibles(AIContext context)
        {
            var action = Promt("Now, what to do..?");

            return(PerformAction(context, action));
        }
Ejemplo n.º 16
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
		}
 public EFUpdateVehicleTypeCommand(AIContext context) : base(context)
 {
 }
Ejemplo n.º 18
0
        public override float Score(IAIContext context)
        {
            AIContext ctx = (AIContext)context;

            return(ctx.target.Stats.Presence * score);
        }
 public EFGetSingleVehicleCommand(AIContext context) : base(context)
 {
 }
Ejemplo n.º 20
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			AIEntityContext ec = context as AIEntityContext;
			if (!ec.Owner || !ec.Leader)
				return BehaviourStatus.FAILURE;
			
			IAIState curState = Machine.GetCurrentState();
			if (curState.StateID != AITypeID.AI_PATH)
			{
				return BehaviourStatus.SUCCESS;
			}
			
			return BehaviourStatus.RUNNING;
		}
Ejemplo n.º 21
0
 public EFGetBrandsCommand(AIContext context) : base(context)
 {
 }
Ejemplo n.º 22
0
 private GameScreen SetGoal(AIContext context, GoalState goal)
 {
     context.SetGoal(goal);
     context.Player.Think(Domain);
     return(context.CurrentScreen);
 }
 public EFInsertRentCommand(AIContext context, IEmailSender emailSender) : base(context)
 {
     _emailSender = emailSender;
 }
Ejemplo n.º 24
0
 public EFGetSingleBrandCommand(AIContext context) : base(context)
 {
 }
Ejemplo n.º 25
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			return Children [Index].Run (context);
		}
 public EFDeleteCustomerCommand(AIContext context) : base(context)
 {
 }
Ejemplo n.º 27
0
 public void DrawGizmos(AIContext context)
 {
     Gizmos.color = new Color(1f, 0f, 0f, 0.125f);
     Gizmos.DrawSphere(context.Position, EyeSight);
 }
Ejemplo n.º 28
0
		/// <summary>
		/// Raises the start event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnStart(AIContext context)
		{
			base.OnStart (context);
			
			AIEntityContext ec = context as AIEntityContext;
			if (!ec.Owner)
				throw new System.NullReferenceException ();
			
			Machine = ec.Owner.GetMachine ();
			if (!Machine)
				throw new System.NullReferenceException();
	
			// follow target
			if (ec.Leader)
				FollowTarget(ec);
		}
Ejemplo n.º 29
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			AIEntityContext ec = context as AIEntityContext;
			if (!ec.Owner || !ec.Target)
				return BehaviourStatus.FAILURE;
			
			// if find path stop
			IAIState curState = Machine.GetCurrentState ();
			if (curState.StateID != AITypeID.AI_PATH)
				return BehaviourStatus.SUCCESS;
			
			return BehaviourStatus.RUNNING;
		}
Ejemplo n.º 30
0
		/// <summary>
		/// Raises the exit event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override void 			OnExit(AIContext context)
		{
			base.OnExit(context);
		}
 protected abstract float CalculateCost(AIContext c);
Ejemplo n.º 32
0
		/// <summary>
		/// Raises the update event.
		/// </summary>
		/// <param name="context">Context.</param>
		public override BehaviourStatus	OnUpdate(AIContext context)
		{
			float fElapsed = Time.time - StartTime;
			return fElapsed > WaitTime ? BehaviourStatus.SUCCESS : BehaviourStatus.RUNNING;
		}
 public EFDeleteExtraAddonCommand(AIContext context) : base(context)
 {
 }