public void Stop() { if (TargetEntityComponent != null && EntityComponent != null) { TargetEntityComponent.RemoveActiveCounterpart(EntityComponent.RootEntity as ICECreatureEntity); } if (Automatic.Stop()) { FireOneShot(m_TargetTransform); } }
/// <summary> /// Fires a burst if /// </summary> /// <param name="_target">Target.</param> /// <param name="_limit">Limit.</param> public void FireBurst(Transform _target, int _limit) { m_TargetTransform = _target; if (TargetEntityComponent != null && EntityComponent != null) { TargetEntityComponent.AddActiveCounterpart(EntityComponent.RootEntity as ICECreatureEntity); } if (Automatic.Enabled) { Automatic.StartWithImpulsLimit(_limit); } else { FireOneShot(_target); } }
public void Fire(Transform _target, bool _reset) { //Debug.Log( "TEST: Fire" ); m_TargetTransform = _target; if (TargetEntityComponent != null && EntityComponent != null) { TargetEntityComponent.AddActiveCounterpart(EntityComponent.RootEntity as ICECreatureEntity); } if (Automatic.Enabled) { Automatic.Start(_reset); } else { FireOneShot(_target); } }
public static BehaviourStatus SetItemAsTarget(BtContext context, ItemTypes itemType) { var position = context.Agent.GetComponent <PositionComponent>(); var lootableNode = context.Engine .GetNodes <ItemNode>() .Where(x => x.ItemComponent.ItemType == itemType) .OrderBy(x => Vector2.Distance(x.PositionComponent.Position, position.Position)) .FirstOrDefault(); if (lootableNode == null) { return(BehaviourStatus.Failed); } var targetComponent = new TargetEntityComponent { TargetId = lootableNode.Entity.Id }; context.Agent.AddComponent(targetComponent); return(BehaviourStatus.Succeeded); }