Ejemplo n.º 1
0
 public void check(AfterFixedUpdateEvent e, TankNode tank)
 {
     if (tank.tankMovementSender.LastSentMovement != null)
     {
         Vector3 position = tank.tankMovementSender.LastSentMovement.Value.Position;
         Vector3 vector3  = tank.rigidbody.Rigidbody.worldCenterOfMass - position;
         if ((vector3.sqrMagnitude >= 0.0001) && Physics.SphereCast(new Ray(position, vector3.normalized), 0.04f, vector3.magnitude, LayerMasks.STATIC))
         {
             base.ScheduleEvent <SendTankMovementEvent>(tank);
         }
     }
 }
Ejemplo n.º 2
0
        public void OnAfterFixedUpdate(AfterFixedUpdateEvent e, TankNode tankNode, [JoinByTank] WeaponNode weaponNode)
        {
            TankMovementSenderComponent tankMovementSender = tankNode.tankMovementSender;
            Rigidbody rigidbody = tankNode.rigidbody.Rigidbody;
            Vector3   velocity  = rigidbody.velocity;
            float     num       = this.SqrMagnitudeXZ(velocity);
            Vector3   vector    = tankMovementSender.LastPhysicsMovement.Velocity;

            if (((((tankMovementSender.LastSentMovement == null) || (((Mathf.Clamp(velocity.y, 0f, float.MaxValue) - Mathf.Clamp(vector.y, 0f, float.MaxValue)) / Time.fixedDeltaTime) > 20f)) || ((this.SqrMagnitudeXZ(vector) > (num + 0.01)) && ((this.SqrMagnitudeXZ(tankMovementSender.LastSentMovement.Value.Velocity) + 0.01) < this.SqrMagnitudeXZ(vector)))) || this.IsXZDistanceTooLarge(tankMovementSender.LastSentMovement.Value.Position, rigidbody.position)) || this.IsYDistanceTooLarge(tankMovementSender.LastSentMovement.Value.Position, rigidbody.position))
            {
                this.CollectCommandsAndSend(tankNode, weaponNode, MoveCommandType.TANK);
            }
        }
Ejemplo n.º 3
0
 public void FixNan4(AfterFixedUpdateEvent e, SingleNode <WeaponInstanceComponent> weaponNode)
 {
     FixNan(weaponNode.component.WeaponInstance.gameObject);
 }
Ejemplo n.º 4
0
 public void FixNan2(AfterFixedUpdateEvent e, SingleNode <HullInstanceComponent> tankNode)
 {
     FixNan(tankNode.component.HullInstance.gameObject);
 }