예제 #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
파일: AIWaitForTime.cs 프로젝트: oathx/Six
		/// <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;
		}
예제 #15
0
        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
파일: Presence.cs 프로젝트: TforTrevor/DD2
        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)
 {
 }
예제 #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;
 }
예제 #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
파일: AIWaitForTime.cs 프로젝트: oathx/Six
		/// <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)
 {
 }