本文整理汇总了C#中Degree类的典型用法代码示例。如果您正苦于以下问题:C# Degree类的具体用法?C# Degree怎么用?C# Degree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Degree类属于命名空间,在下文中一共展示了Degree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Teacher ta = new Teacher();
Course cu = new Course("Programming with C#");
for(int i = 1; i <= 3 ; i++){
Student student = new Student("student"+i, "a" + i);
for (int j = 0; j <= 4; j++) {
student.Grades.Push(100-(j*10));
}
cu.AddStudent(student);
}
cu.ListStudent();
ta.FirstName = "ta";
ta.LastName = "1";
Degree dg = new Degree("Bachelor");
UProgram up = new UProgram("Information Technology");
Console.WriteLine("The {0} program contains the {1} of Science degree\r\n", up.ProgrameName, dg.DegreeName);
Console.WriteLine("The {0} of Science degree contains the course {1}\r\n", dg.DegreeName, cu.CourseName);
Console.WriteLine("The {0} course contain {1} studeent(s)", cu.CourseName, cu.countnum);
Console.WriteLine("Press any key to continue....");
Console.ReadKey();
}
示例2: OnGetCameraTransform
protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
out Vec3 up, ref Degree cameraFov )
{
position = Vec3.Zero;
forward = Vec3.XAxis;
up = Vec3.ZAxis;
Unit unit = GetPlayerUnit();
if( unit == null )
return;
PlayerIntellect.Instance.FPSCamera = false;
//To use data about orientation the camera if the cut scene is switched on
if( IsCutSceneEnabled() )
{
if( CutSceneManager.Instance.GetCamera( out position, out forward, out up, out cameraFov ) )
return;
}
float distance = 25;
position = unit.GetInterpolatedPosition() + new Vec3( 0, -distance, 0 );
forward = Vec3.YAxis;
up = Vec3.ZAxis;
}
示例3: AddBulletAndHit
public bool AddBulletAndHit(VanillaCharacter source, Vector3 decalage, VanillaCharacter target)
{
Vector3 sourcePoint = source.FeetPosition + (source.Size.y / 2) * Vector3.UNIT_Y + decalage;
Vector3 targetPoint = target.FeetPosition + target.Size.y / 2 * Vector3.UNIT_Y;
Vector3 diff = targetPoint - sourcePoint;
if (Math.Abs(diff.y / Cst.CUBE_SIDE) > 6) { return false; }
Degree pitch = -Math.ATan2(diff.y, diff.z);
Degree yaw = source.GetYaw();
if (yaw.ValueAngleUnits > 90 && yaw.ValueAngleUnits < 270)
{
yaw *= -1;
yaw += new Degree(180);
}
float targetDistance = diff.Length;
Ray ray = new Ray(sourcePoint + Vector3.NEGATIVE_UNIT_Z, diff.NormalisedCopy);
float blockDistance = VanillaBlock.getBlockOnRay(source.getIsland(), ray, Bullet.DEFAULT_RANGE, 30);
if (targetDistance > blockDistance) { return false; }
SceneNode pitchNode = this.SceneMgr.RootSceneNode.CreateChildSceneNode();
pitchNode.Position = sourcePoint;
pitchNode.Pitch(pitch);
SceneNode yawNode = pitchNode.CreateChildSceneNode();
yawNode.Yaw(yaw);
yawNode.AttachObject(StaticRectangle.CreateLine(this.SceneMgr, Vector3.ZERO, new Vector3(0, 0, 15), ColoredMaterials.YELLOW));
this.mBullets.Add(new Bullet(source, target, pitchNode, yawNode));
return true;
}
示例4: FreeCameraMode
/**
* @param margin Collision margin
* @param switchingMode Determine the state of the camera when switching to this camera mode from another
*/
public FreeCameraMode(CameraControlSystem cam
, Vector3 initialPosition
, Degree initialRotationX
, Degree initialRotationY
, SwitchingMode switchingMode = SwitchingMode.CurrentState
, float margin = 0.1f)
: base(cam)
{
CameraCS = cam;
Margin = margin;
_fixedAxis = Vector3.UNIT_Y;
_moveFactor = 1;
_rotationFactor = 0.13f;
_rotX = initialRotationX;
_rotY = initialRotationY;
_initialPosition = initialPosition;
_initialRotationX = initialRotationX;
_initialRotationY = initialRotationY;
_lastRotationX = initialRotationX;
_lastRotationY = initialRotationY;
_lastPosition = initialPosition;
_switchingMode = switchingMode;
CameraPosition = initialPosition;
this.CollisionFunc = this.DefaultCollisionDetectionFunction;
}
示例5: EarthArea
/// <summary>Создаёт трапециевидную область, содержащую все указанные точки</summary>
/// <param name="Points">Массив точек, вокруг которых должна быть описана область</param>
public EarthArea(params EarthPoint[] Points)
: this()
{
MostWesternLongitude = new Degree(Points.Min(p => p.Longitude));
MostEasternLongitude = new Degree(Points.Max(p => p.Longitude));
MostSouthernLatitude = new Degree(Points.Min(p => p.Latitude));
MostNorthenLatitude = new Degree(Points.Max(p => p.Latitude));
}
示例6: DegreesFromComponents
public void DegreesFromComponents()
{
Degree degree = new Degree(10, 20, 30, CoordinateType.Latitude);
Assert.AreEqual(degree.CoordinateType, CoordinateType.Latitude);
Assert.AreEqual(degree.Degrees, 10);
Assert.AreEqual(degree.Minutes, 20);
Assert.AreEqual(degree.Seconds, 30);
}
示例7: LocRecord
/// <summary>
/// Creates a new instance of the LocRecord class.
/// </summary>
/// <param name="name">Name of the record.</param>
/// <param name="timeToLive">Seconds the record should be cached at most.</param>
/// <param name="version">Version number of representation.</param>
/// <param name="size">Size of location in centimeters.</param>
/// <param name="horizontalPrecision">Horizontal precision in centimeters.</param>
/// <param name="verticalPrecision">Vertical precision in centimeters.</param>
/// <param name="latitude">Latitude of the geographical position.</param>
/// <param name="longitude">Longitude of the geographical position.</param>
/// <param name="altitude">Altitude of the geographical position.</param>
public LocRecord(string name, int timeToLive, byte version, double size, double horizontalPrecision, double verticalPrecision, Degree latitude, Degree longitude, double altitude)
: base(name, RecordType.Loc, RecordClass.INet, timeToLive)
{
this.Version = version;
this.Size = size;
this.HorizontalPrecision = horizontalPrecision;
this.VerticalPrecision = verticalPrecision;
this.Latitude = latitude;
this.Longitude = longitude;
this.Altitude = altitude;
}
示例8: GetFactor
// return between -1 and 1
public static float GetFactor(Degree diffYaw)
{
float diffYawFloat = diffYaw.ValueAngleUnits;
while (diffYawFloat > 180) { diffYawFloat -= 360; }
while (diffYawFloat <= -180) { diffYawFloat += 360; }
int sign = System.Math.Sign(diffYawFloat);
diffYawFloat *= sign; // Take the abs value
float factor = A * diffYawFloat * diffYawFloat + B * diffYawFloat; // Here factor is between 0 and 1
return (factor > 1 ? 1 : factor) * sign;
}
示例9: CMS
public CMS(AEvent aDevice, CategoryType type, System.Collections.Hashtable ht, DeviceType devType, System.Collections.Hashtable DevRange, Degree degree)
{
Initialize(aDevice, type, ht, devType, DevRange, degree);
this.GetMessRuleData += new GetMessRuleDataHandler(CMS_GetMessRuleData);
List<object> messColors = (List<object>)com.select(DBConnect.DataType.MessColor, Command.GetSelectCmd.getMessColor());
messColorsHT = new System.Collections.Hashtable();
foreach (object obj in messColors)
{
MessColor mess = (MessColor)obj;
messColorsHT.Add(mess.ID, mess);
}
}
示例10: Main
static void Main(string[] args)
{
// Creating three student objects, since it's at least three.
Student stud1 = new Student("Surya", "Raman", "[email protected]");
Student stud2 = new Student("Narendra", "Mdoi","[email protected]");
Student stud3 = new Student("Barack", "Obama", "[email protected]");
//Now creating the course object with dev204X
Course course = new Course("DEV204X", 5);
//Using the method at the end of this code to add students to course
course.addStudent(stud1);
course.addStudent(stud2);
course.addStudent(stud3);
// Creating one teacher object since that's the minimum number
Teacher teacher = new Teacher("Bruce", "Wayne", "[email protected]");
// Using the method at the end of this code to add teacher to course
course.addTeacher(teacher);
// Creating Degree object, assuming Computer Science and Engineering degree
Degree degree = new Degree("Computer Science and Engineering", 250, null);
// Adding Course object to the Degree object
degree.Course = course;
//Creating UProgram object with Bachelor of Engineering
UProgram uProgram = new UProgram("Bachelor of Engineering", "Lex Luthor", null);
// Adding the Degree object to the UProgram object
uProgram.Degree = degree;
// Printing everything as per the Assignment instructions
Console.WriteLine("The {0} program contains the {1} degree\n", uProgram.ProgramName, degree.DegreeName);
Console.WriteLine("The {0} degree contains the course {1}\n", degree.DegreeName, course.CourseName);
Console.WriteLine("The {0} course contains {1} student(s)\n", course.CourseName, course.studentNumber);
Console.ReadKey();
}
示例11: Kart
public Kart(ThingBlock block, ThingDefinition def)
: base(block, def)
{
DefaultMaxSpeed = MaxSpeed = def.GetFloatProperty("maxspeed", 180f);
MaxReverseSpeed = def.GetFloatProperty("maxreversespeed", 4f);
MaxSpeedSquared = MaxSpeed * MaxSpeed;
MaxReverseSpeedSquared = MaxReverseSpeed * MaxReverseSpeed;
IsInAir = false;
FrontDriftAngle = new Degree(def.GetFloatProperty("FrontDriftAngle", 46)).ValueRadians;
BackDriftAngle = new Degree(def.GetFloatProperty("BackDriftAngle", 55)).ValueRadians;
DriftTransitionAngle = new Degree(def.GetFloatProperty("DriftTransitionAngle", 40));
}
示例12: DegreesTest
public void DegreesTest()
{
Degree target = new Degree(20.5);
Assert.AreEqual(20, target.Degrees);
Assert.AreEqual(30, target.Minutes);
Assert.AreEqual(0, target.Seconds);
target = new Degree(-(10 + 21.0 / 60 + 34.22 / 3600));
Assert.AreEqual(-10, target.Degrees);
Assert.AreEqual(21, target.Minutes);
Assert.AreEqual(34, target.Seconds);
Assert.AreEqual(34.22, Math.Round(target.TotalSeconds, 3));
target = new Degree(37.85);
Assert.AreEqual(37, target.Degrees);
}
示例13: OnGetCameraTransform
protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
out Vec3 up, ref Degree cameraFov )
{
position = Vec3.Zero;
forward = Vec3.XAxis;
up = Vec3.ZAxis;
MapCamera mapCamera = Entities.Instance.GetByName( "MapCamera_0" ) as MapCamera;
if( mapCamera != null )
{
position = mapCamera.Position;
forward = mapCamera.Rotation * new Vec3( 1, 0, 0 );
up = mapCamera.Rotation * new Vec3( 0, 0, 1 );
if( mapCamera.Fov != 0 )
cameraFov = mapCamera.Fov;
}
}
示例14: Main
static void Main(string[] args)
{
string[] atts = { "Sophie", "Greene", "1/12/1991", "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK","Student" };
string[] att = { "Manual", "Zu", "1/12/1937", "30 Other Street", "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK","Teacher" };
Person student = new Person(atts);
student.print();
Person teacher = new Person(att);
teacher.print();
//ensure console window stays open
string[] pAtt = {"Intro to Computer Science","Some Guy","BSc. blah blah" };
UProgram prog = new UProgram(pAtt);
prog.print();
Degree deg = new Degree("Bsc. A M", 72);
deg.print();
Course cour = new Course("Intro hbla", 3, 9, "Mr blah Person");
cour.print();
Console.Read();
}
示例15: OnGetCameraTransform
protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward, out Vec3 up,
ref Degree cameraFov)
{
//camera management for demo mode
if( demoMode && !FreeCameraEnabled )
{
MapCameraCurve curve;
float curveTime;
GetDemoModeMapCurve( out curve, out curveTime );
if( curve != null )
{
curve.CalculateCameraPositionByTime( curveTime, out position, out forward, out up,
out cameraFov );
return;
}
}
base.OnGetCameraTransform( out position, out forward, out up, ref cameraFov );
}