示例#1
0
        /// <summary>
        /// Queues the ball to be destroyed at the next cycle.
        /// </summary>
        ///
        /// <remarks>
        /// If there is not ball in the kicker, this does nothing.
        /// </remarks>
        public void DestroyBall()
        {
            var entityManager       = World.DefaultGameObjectInjectionWorld.EntityManager;
            var kickerCollisionData = entityManager.GetComponentData <KickerCollisionData>(Entity);
            var ballEntity          = kickerCollisionData.BallEntity;

            if (ballEntity != Entity.Null)
            {
                _ballManager.DestroyEntity(ballEntity);
                SimulationSystemGroup.QueueAfterBallCreation(() => DestroyBall(Entity));
            }
        }
示例#2
0
 /// <summary>
 /// Destroys the ball and simulates a drain.
 /// </summary>
 private void OnEntry(object sender, SwitchEventArgs args)
 {
     if (args.IsEnabled)
     {
         Logger.Info("Draining ball into trough.");
         if (_drainSwitch is KickerApi kickerApi)
         {
             kickerApi.DestroyBall();
         }
         else
         {
             BallManager.DestroyEntity(args.BallEntity);
         }
         DrainBall();
     }
     else
     {
         Logger.Error("Draining ball into trough.");
     }
 }