Example #1
0
        public void Stop()
        {
            if (TargetEntityComponent != null && EntityComponent != null)
            {
                TargetEntityComponent.RemoveActiveCounterpart(EntityComponent.RootEntity as ICECreatureEntity);
            }

            if (Automatic.Stop())
            {
                FireOneShot(m_TargetTransform);
            }
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
        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);
        }