当前位置: 首页>>代码示例>>C#>>正文


C# Point.GetRotation方法代码示例

本文整理汇总了C#中System.Point.GetRotation方法的典型用法代码示例。如果您正苦于以下问题:C# Point.GetRotation方法的具体用法?C# Point.GetRotation怎么用?C# Point.GetRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Point的用法示例。


在下文中一共展示了Point.GetRotation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeCompass

		public void InitializeCompass()
		{
			var compass = Assets.Default.compasscolor;
			var container = new Sprite();

			container.alpha = 0;

			CompassContainer = container;

			compass.AttachTo(container);
			container.AttachTo(HudContainer);

			Action Update =
				delegate
				{
					// compass must show us where the goal is

					var delta = new Point(maze.Width - 1.5 - EgoView.ViewPositionX, maze.Height - 1.5 - EgoView.ViewPositionY);

					container.rotation = (delta.GetRotation() - EgoView.ViewDirection).RadiansToDegrees();


				};

			EgoView.ViewDirectionChanged += Update;

			EgoView.ViewPositionChanged += Update;

			Update();

			compass.scaleX = 0.5;
			compass.scaleY = 0.5;

			compass.x = -compass.width / 2;
			compass.y = -compass.height / 2;

			container.filters = new[] { new ScriptCoreLib.ActionScript.flash.filters.DropShadowFilter() };

			container.x = DefaultControlWidth - compass.width / 2;
			container.y = compass.height / 2;
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:41,代码来源:FlashTreasureHunt.Compass.cs

示例2: Update

        public void Update(double x, double y, double left, double right)
        {
            RelativePosition = new Point
            {
                x = Sprite.Position.x - x,
                y = Sprite.Position.y - y
            };

           

            Direction = RelativePosition.GetRotation();

            Distance = RelativePosition.length;

            ViewInfo.Left = left;
            ViewInfo.Right = right;
            ViewInfo.Target = Direction;

            ViewInfo.Update();

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:21,代码来源:SpriteInfoFromPOV.cs

示例3: FlashTowerDefenseSized


//.........这里部分代码省略.........
            Ego.FoundMoreAmmo +=
                weapon => ShowMessage("Got ammo for " + weapon.Name);



            Action Reorder =
                delegate
                {
#if Z
                    GetWarzone().Children().OrderBy(i => (double)i.y).
                       ForEach(
                        (k, i) =>
                            k.parent.setChildIndex(k, i)
                    );
#endif

                };

            Action ReorderThrottle = Reorder.ThrottleTo(1000);

            var EgoMoveUpTimer = (1000 / 30).AtInterval(
                delegate
                {
                    if (EgoMoveToMouseTarget)
                    {
                        var p = new Point { x = CurrentTarget.x - Ego.x, y = CurrentTarget.y - Ego.y };

                        if (p.length <= EgoMoveSpeed)
                        {
                            // run one the pointer
                            return;
                        }

                        Ego.MoveToArc(p.GetRotation(), EgoMoveSpeed);
                    }
                    else
                        Ego.MoveToArc(EgoAimDirection, EgoMoveSpeed);

                    Ego.x = Math.Min(Math.Max(Ego.x, 0), DefaultWidth);
                    Ego.y = Math.Min(Math.Max(Ego.y, 0), DefaultHeight);
                    ReorderThrottle();

                    UpdateEgoAim();

                    EgoMovedSlowTimer.start();

                    // we moved now let's check for boxes
                    foreach (var BoxToTake in
                                     from ss in Boxes
                                     where new Point { x = Ego.x - ss.x, y = Ego.y - ss.y }.length < 32
                                     select ss)
                    {
                        BoxToTake.RemoveFrom(Boxes).Orphanize();

                        Sounds.sound20.ToSoundAsset().play();

                        if (BoxToTake.WeaponInside == null)
                        {
                            // add stuff, so the player doesn't get bored:D
                            // maybe implment them too? see Diablo.
                            var PowerUps = new[] { 
                                // gta
                                "Double Damage", 
                                "Fast Reload", 
                                "Respect",
                                "Armour",
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:FlashTowerDefenseSized.cs

示例4: DoSomeDamage

        private void DoSomeDamage(Point DamagePointOfOrigin, double DamageDirection, WeaponInfo Weapon)
        {

            ShowBulletsFlying(DamagePointOfOrigin, DamageDirection, Weapon);

            if (NetworkShowBulletsFlying != null)
                NetworkShowBulletsFlying(
                    DamagePointOfOrigin.x.ToInt32(),
                    DamagePointOfOrigin.y.ToInt32(),
                    DamageDirection.RadiansToDegrees(),
                    Weapon.NetworkId
                    );

            var AllMortals = this.AllMortals.ToArray();

            //Console.WriteLine("mortals in warzone: " + AllMortals.Length);

            foreach (var DeadManWalking in AllMortals)
            {
                var DamageThisDude = true;

                // why bother shooting itself?
                if (DeadManWalking == Ego)
                    if (!Weapon.CanHurtEgo)
                        DamageThisDude = false;

                if (!DeadManWalking.IsAlive)
                    DamageThisDude = false;

                if (DamageThisDude)
                {
                    var Location = new Point { x = DamagePointOfOrigin.x, y = DamagePointOfOrigin.y }.MoveToArc(DamageDirection, -32);
                    var Offset = new Point { y = DeadManWalking.y - Location.y, x = DeadManWalking.x - Location.x };
                    var Arc = Offset.GetRotation();
                    var Distance = Offset.length;

                    Func<double, double> Warp = i => i % (Math.PI * 2);

                    var LessThan = Arc < (Warp(DamageDirection) + Weapon.ArcRange);
                    var MoreThan = Arc > (Warp(DamageDirection) - Weapon.ArcRange);

                    var Hit = LessThan && MoreThan;

                    if (Distance < Weapon.Range)
                        if (Hit)
                        {
                            // calculate damage variation here based on hit approximity

                            DeadManWalking.AddDamageFromDirection(Weapon.Damage, Arc, true);

                            if (NetworkAddDamageFromDirection != null)
                                NetworkAddDamageFromDirection(
                                    DeadManWalking.NetworkId,
                                    Weapon.Damage,
                                    Arc.RadiansToDegrees()
                                );
                        }
                }

            }
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:61,代码来源:FlashTowerDefenseSized.cs

示例5: Tycoon4


//.........这里部分代码省略.........

            #region StartLoadingDudeAnimationInfo
            Action<DudeAnimationInfo> StartLoadingDudeAnimationInfo =
                a =>
                {
                    a.Frames_Stand.ForEach(i => StartLoadingSingleImage(i.Image));
                    a.Frames_Walk.ForEach(j => j.ForEach(i => StartLoadingSingleImage(i.Image)));
                };
            #endregion

            var Argh = new Argh();
            var CloneAffirmative = new EN_000002();
            var Affirmative = new Affirmative();
            var click = new click();
            var Hammertime = new SAMPLES234 { volume = 0.1 };
            var Sawtime = new SAMPLES216 { volume = 0.1 };
            var StoneHammerTime = new SAMPLES233 { volume = 0.1 };


            #endregion

            #region AllImagesLoaded
            AllImagesLoaded +=
                delegate
                {
                    Console.WriteLine("AllImagesLoaded");

                    info.innerText = "Loading images... done!";

                    #region Translate
                    Func<double, double, Point<double>> Translate =
                        (_x, _y) =>
                        {
                            var _r = ZeroPoint.GetRotation(_x, _y) + RotationA;
                            var _d = ZeroPoint.GetDistance(_x, _y) * bg_size.h * 2d.Sqrt();

                            _x = Math.Cos(_r) * _d;
                            _y = Math.Sin(_r) * _d * RotationB;

                            return new Point<double> { X = _x, Y = _y };
                        };
                    #endregion

                    #region Translator
                    var Translator = new CoordTranslatorBase
                    {
                        ConvertMapToCanvas = map_coords =>
                        {
                            var canvas_coords = Translate(map_coords.X, map_coords.Y);
                            var c = GetCenter();

                            canvas_coords.X += c.X;
                            canvas_coords.Y += c.Y;

                            return canvas_coords;

                        },
                        ConvertCanvasToMap = canvas =>
                        {
                            var c = GetCenter();

                            var offset = new Point<double> { X = canvas.X - c.X, Y = (canvas.Y - c.Y) / RotationB };

                            var d = ZeroPoint.GetDistance(offset) / (bg_size.h * 2d.Sqrt());
                            var r = ZeroPoint.GetRotation(offset) - RotationA;
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:66,代码来源:Tycoon4.cs

示例6: WalkTo

        public void WalkTo(double _x, double _y)
        {
            _TargetX = _x;
            _TargetY = _y;

            var EgoMoveSpeed = 3;

            if (_TargetTimer == null)
                _TargetTimer =
                    (1000 / 30).AtInterval(
                        delegate
                        {
                            var p = new Point { x = _TargetX - this.x, y = _TargetY - this.y };

                            if (p.length <= (EgoMoveSpeed * 2))
                            {
                                100.AtDelayDo(
                                    delegate
                                    {
                                        if (!_TargetTimer.running)
                                            RunAnimation = false;
                                    }
                                );

                                _TargetTimer.stop();
                                
                                return;
                            }

                            this.MoveToArc(p.GetRotation(), EgoMoveSpeed);
                        }
                    );

            RunAnimation = true;
            _TargetTimer.start();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:36,代码来源:Actor.cs


注:本文中的System.Point.GetRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。