コード例 #1
0
    public static bool IsClosing(Ship.GenericShip thisShip, Ship.GenericShip anotherShip)
    {
        bool  result          = false;
        float distanceToFront = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralFrontPoint());
        float distanceToBack  = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralBackPoint());

        result = (distanceToFront < distanceToBack) ? true : false;
        return(result);
    }
コード例 #2
0
ファイル: Actions.cs プロジェクト: keldren/FlyCasual
    public static bool IsClosing(Ship.GenericShip thisShip, Ship.GenericShip anotherShip)
    {
        bool result = false;

        ShipDistanceInformation distanceInfo = new ShipDistanceInformation(thisShip, anotherShip);
        int range = distanceInfo.Range;

        if (range <= 1)
        {
            return(true);
        }
        if (range >= 3)
        {
            return(false);
        }

        float distanceToFront = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralFrontPoint());
        float distanceToBack  = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralBackPoint());

        result = (distanceToFront < distanceToBack) ? true : false;
        return(result);
    }
コード例 #3
0
    public static void ApplyMovementRuler(Ship.GenericShip thisShip, Movement.GenericMovement movement)
    {
        CurrentTemplate = GetMovementRuler(movement);

        SaveCurrentMovementRulerPosition();

        CurrentTemplate.position    = thisShip.GetPosition();
        CurrentTemplate.eulerAngles = thisShip.GetAngles() + new Vector3(0f, 90f, 0f);
        if (movement.Direction == Movement.ManeuverDirection.Left)
        {
            CurrentTemplate.eulerAngles = CurrentTemplate.eulerAngles + new Vector3(180f, 0f, 0f);
        }
    }
コード例 #4
0
    public static void ApplyMovementRuler(Ship.GenericShip thisShip)
    {
        if (Selection.ThisShip.AssignedManeuver.Speed != 0)
        {
            CurrentTemplate = GetMovementRuler();

            SaveCurrentMovementRulerPosition();

            CurrentTemplate.position    = thisShip.GetPosition();
            CurrentTemplate.eulerAngles = thisShip.GetAngles() + new Vector3(0f, 90f, 0f);
            if (Selection.ThisShip.AssignedManeuver.Direction == Movement.ManeuverDirection.Left)
            {
                CurrentTemplate.eulerAngles = CurrentTemplate.eulerAngles + new Vector3(180f, 0f, 0f);
            }
        }
    }