コード例 #1
0
ファイル: Rope.cs プロジェクト: aiv01/aiv-fast2d
        public void SetDestination(Vector2 destination)
        {
            destination -= this.position;
            Vector2 direction = destination.Normalized();
            currentLength = Math.Min(maxLength, destination.Length);
            Point2 = direction * currentLength;

            // update the angle between the rope and the up vector (if required)
            if (!angleSet)
            {
                angle = (float)Math.Acos(Vector2.Dot(new Vector2(0, 1), Point2.Normalized()));

                angleSet = true;
            }
        }
コード例 #2
0
ファイル: Human.cs プロジェクト: alexturpin/Zombles
        public void StartMoving(Vector2 dir)
        {
            if (float.IsNaN(dir.X) || float.IsNaN(dir.Y)) {
                return;
            }

            if (Movement == null || !Health.IsAlive)
                return;

            if (!Anim.Playing || !Movement.IsMoving || Anim.CurAnim != WalkAnim)
                Anim.Start(WalkAnim);

            _moveDir = dir.Normalized();

            Anim.Speed = MoveSpeed;
        }