Beispiel #1
0
 /// <summary>
 /// Compares internal data for equality.
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 public bool Equals(Detonation b)
 {
     if (!WarfareHeader.Equals(this, b))
     {
         return(false);
     }
     if (!velocity.Equals(b.velocity))
     {
         return(false);
     }
     if (!locationInWorldCoordinates.Equals(b.locationInWorldCoordinates))
     {
         return(false);
     }
     if (descriptor != null && !descriptor.Equals(b.descriptor))
     {
         return(false);
     }
     if (!locationInEntityCoordinates.Equals(b.locationInEntityCoordinates))
     {
         return(false);
     }
     if (!detonationResult.Equals(b.detonationResult))
     {
         return(false);
     }
     if (!variableParameters.Equals(b.variableParameters))
     {
         return(false);
     }
     return(true);
 }
Beispiel #2
0
 /// <summary>
 /// Compares internal data for equality.
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 public bool Equals(Fire b)
 {
     if (!WarfareHeader.Equals(this, b))
     {
         return(false);
     }
     if (fireMissionIndex != b.fireMissionIndex)
     {
         return(false);
     }
     if (!locationInWorldCoordinates.Equals(b.locationInWorldCoordinates))
     {
         return(false);
     }
     if (descriptor != null && !descriptor.Equals(b.descriptor))
     {
         return(false);
     }
     if (!velocity.Equals(b.velocity))
     {
         return(false);
     }
     if (range != b.range)
     {
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// Compares internal data for equality.
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 public bool Equals(EntityState b)
 {
     if (!Header.Equals(this, b))
     {
         return(false);
     }
     if (!entityID.Equals(b.entityID))
     {
         return(false);
     }
     if (forceID != b.forceID)
     {
         return(false);
     }
     if (!entityType.Equals(b.entityType))
     {
         return(false);
     }
     if (!alternateEntityType.Equals(b.alternateEntityType))
     {
         return(false);
     }
     if (!linearVelocity.Equals(b.linearVelocity))
     {
         return(false);
     }
     if (!location.Equals(b.location))
     {
         return(false);
     }
     if (!orientation.Equals(b.orientation))
     {
         return(false);
     }
     if (!appearance.Equals(b.appearance))
     {
         return(false);
     }
     if (!deadReckoningParameter.Equals(b.deadReckoningParameter))
     {
         return(false);
     }
     if (!marking.Equals(b.marking))
     {
         return(false);
     }
     if (!capabilities.Equals(b.capabilities))
     {
         return(false);
     }
     if (!variableParameters.Equals(b.variableParameters))
     {
         return(false);
     }
     return(true);
 }
    internal void MoveUnit(GameObject unit, float movementSpeed)
    {
        //if (count == 1) return;
        if (isMoving == false)
        {
            return;
        }

        if (destinationCoordinates.Equals(currentCoordinates) || path.Count < 0)
        {
            ++count;
            Debug.Log("Final currentCoordinates" + currentCoordinates.X + " " + currentCoordinates.Y);
            Debug.Log("Destination " + destinationCoordinates.X + " " + destinationCoordinates.Y);
            unit.transform.position = new Vector2(destinationCoordinates.X, destinationCoordinates.Y);
            isMoving = false;

            return;
        }
        if (nextCoordinates.X < currentCoordinates.X)
        {
            currentCoordinates.X -= 1;
        }
        else if (nextCoordinates.X > currentCoordinates.X)
        {
            currentCoordinates.X += 1;
        }

        if (nextCoordinates.Y < currentCoordinates.Y)
        {
            currentCoordinates.Y -= 1;
        }
        else if (nextCoordinates.Y > currentCoordinates.Y)
        {
            currentCoordinates.Y += 1;
        }

        unit.transform.position = new Vector2(currentCoordinates.X, currentCoordinates.Y);

        if ((nextCoordinates.Equals(currentCoordinates)))
        {
            if (path.Count != 0)
            {
                point             = path.Pop();
                nextCoordinates.X = point.First;
                nextCoordinates.Y = point.Second;
            }
        }

        /*
         * if (destinationTrueCoordinates.Equals(currentTrueCoordinates) || path.Count <= 0)
         * {
         *  Debug.Log("Destination is " + destinationTrueCoordinates.X + " " + destinationTrueCoordinates.Y);
         *  unit.transform.position = new Vector2(currentTrueCoordinates.X, currentTrueCoordinates.Y);
         *  Debug.Log("Test");
         *  currentCoordinates = destinationCoordinates;
         *  Debug.Log("TesTestt");
         *  isMoving = false;
         *  Debug.Log("TesTetetett");
         *
         *  return;
         * }
         *
         * if (!Mathf.Approximately(currentTrueCoordinates.X, nextTrueCoordinates.X))
         * {
         *  if (nextTrueCoordinates.X < currentTrueCoordinates.X)
         *      currentTrueCoordinates.X -= 1;
         *  else if (nextTrueCoordinates.X > currentTrueCoordinates.X)
         *      currentTrueCoordinates.X += 1;
         * }
         *
         * if (!Mathf.Approximately(currentTrueCoordinates.Y, nextTrueCoordinates.Y))
         * {
         *  if (nextTrueCoordinates.Y < currentTrueCoordinates.Y)
         *      currentTrueCoordinates.Y -= 1;
         *  else if (nextTrueCoordinates.Y > currentTrueCoordinates.Y)
         *      currentTrueCoordinates.Y += 1;
         * }
         * unit.transform.position = new Vector2(currentTrueCoordinates.X, currentTrueCoordinates.Y);
         *
         * if ((nextTrueCoordinates.Equals(currentTrueCoordinates))){
         *  point = path.Pop();
         *  nextTrueCoordinates.X = point.First;
         *  nextTrueCoordinates.Y = point.Second;
         * }*/
        /*
         * if (current.Equals(next))
         * {
         *  point = path.Pop();
         *  nextCoordinates.X = point.First;
         *  nextCoordinates.Y = point.Second;
         * }
         * Debug.Log("test");
         * //current = new Vector2(currentCoordinates.X, currentCoordinates.Y);
         * next = new Vector2(nextCoordinates.X, nextCoordinates.Y);
         *
         * var heading = next - current;
         * var distance = heading.magnitude;
         * var direction = heading / distance;
         *
         * current += direction * Time.deltaTime * movementSpeed;
         * unit.transform.position = new Vector2(current.x, current.y);*/
    }