示例#1
0
文件: AISearch.cs 项目: oathx/Six
		/// <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();
				}
			}
		}
示例#2
0
文件: AISequence.cs 项目: oathx/Six
		/// <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);
		}
示例#3
0
文件: AIRepeat.cs 项目: oathx/Six
		/// <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;
		}
示例#4
0
文件: AIRandom.cs 项目: oathx/Six
		/// <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);
		}
示例#5
0
文件: AIRepeat.cs 项目: oathx/Six
		/// <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;
		}
示例#6
0
文件: AIParallel.cs 项目: oathx/Six
		/// <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;
		}
示例#7
0
文件: AIRandom.cs 项目: oathx/Six
		/// <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);
		}
示例#8
0
文件: AIAttack.cs 项目: oathx/Six
		/// <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;
		}
示例#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);
			}
		}
示例#10
0
文件: AISequence.cs 项目: oathx/Six
		/// <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;
		}
示例#11
0
文件: AIAttack.cs 项目: oathx/Six
		/// <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);
			}
		}
示例#12
0
文件: AIPatrol.cs 项目: oathx/Six
		/// <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);
			}
		}
示例#13
0
文件: AIPursue.cs 项目: oathx/Six
		/// <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);
				}
			}
		}
示例#14
0
文件: AIRepeat.cs 项目: oathx/Six
		/// <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));
        }
示例#16
0
文件: AISequence.cs 项目: oathx/Six
		/// <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)
 {
 }
示例#18
0
        public override float Score(IAIContext context)
        {
            AIContext ctx = (AIContext)context;

            return(ctx.target.Stats.Presence * score);
        }
 public EFGetSingleVehicleCommand(AIContext context) : base(context)
 {
 }
示例#20
0
文件: AIFollow.cs 项目: oathx/Six
		/// <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;
		}
示例#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;
 }
示例#24
0
 public EFGetSingleBrandCommand(AIContext context) : base(context)
 {
 }
示例#25
0
文件: AIRandom.cs 项目: oathx/Six
		/// <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)
 {
 }
示例#27
0
 public void DrawGizmos(AIContext context)
 {
     Gizmos.color = new Color(1f, 0f, 0f, 0.125f);
     Gizmos.DrawSphere(context.Position, EyeSight);
 }
示例#28
0
文件: AIFollow.cs 项目: oathx/Six
		/// <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);
		}
示例#29
0
文件: AIPursue.cs 项目: oathx/Six
		/// <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;
		}
示例#30
0
文件: AIPatrol.cs 项目: oathx/Six
		/// <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);
示例#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)
 {
 }