Example #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();
				}
			}
		}
Example #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);
		}
Example #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;
		}
Example #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);
		}
Example #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;
		}
Example #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;
		}
Example #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);
		}
Example #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;
		}
Example #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);
			}
		}
Example #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;
		}
Example #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);
			}
		}
Example #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);
			}
		}
Example #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);
				}
			}
		}
Example #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;
		}
        private GameScreen Interactibles(AIContext context)
        {
            var action = Promt("Now, what to do..?");

            return(PerformAction(context, action));
        }
Example #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)
 {
 }
Example #18
0
        public override float Score(IAIContext context)
        {
            AIContext ctx = (AIContext)context;

            return(ctx.target.Stats.Presence * score);
        }
 public EFGetSingleVehicleCommand(AIContext context) : base(context)
 {
 }
Example #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;
		}
Example #21
0
 public EFGetBrandsCommand(AIContext context) : base(context)
 {
 }
 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;
 }
Example #24
0
 public EFGetSingleBrandCommand(AIContext context) : base(context)
 {
 }
Example #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)
 {
 }
 public void DrawGizmos(AIContext context)
 {
     Gizmos.color = new Color(1f, 0f, 0f, 0.125f);
     Gizmos.DrawSphere(context.Position, EyeSight);
 }
Example #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);
		}
Example #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;
		}
Example #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);
Example #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)
 {
 }