/// <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(); } } }
/// <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); }
/// <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; }
/// <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); }
/// <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; }
/// <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; }
/// <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); }
/// <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; }
/// <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); } }
/// <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; }
/// <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); } }
/// <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); } }
/// <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); } } }
/// <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)); }
/// <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) { }
public override float Score(IAIContext context) { AIContext ctx = (AIContext)context; return(ctx.target.Stats.Presence * score); }
public EFGetSingleVehicleCommand(AIContext context) : base(context) { }
/// <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; }
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; }
public EFGetSingleBrandCommand(AIContext context) : base(context) { }
/// <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); }
/// <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); }
/// <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; }
/// <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);
/// <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) { }