/// <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 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> /// Sets the machine. /// </summary> /// <param name="machine">Machine.</param> public void SetMachine(IAIMachine machine) { m_Machine = machine; }
/// <summary> /// Install this instance. /// </summary> public override void Install() { m_Machine = new IAIMachine (); if (!m_Machine) throw new System.NullReferenceException (); m_Machine.RegisterState (new CameraNormal (this)); }