public void AddTriangle(TriangleData triangleData)
 {
     triangleData.Owner = this;
     TriangleDatas.Add(triangleData);
     if (!ContactPoints.Contains(triangleData.ContactPoint))
     {
         ContactPoints.Add(triangleData.ContactPoint);
     }
     CalculateCenter();
 }
Esempio n. 2
0
 private void Handle(ContactPoints msg)
 {
     //
     // 시작하면 바로 메시지가 전달된다.
     //
     _log.Info(">>> Received - ContactPoints");
     foreach (ActorPath contactPoint in msg.ContactPointsList)
     {
         _log.Info($"\t{contactPoint.ToStringWithAddress()}");
     }
 }
Esempio n. 3
0
 public void ReadChildData(BinaryReader reader)
 {
     _dONTUSE.ReadString(reader);
     _footsteps.ReadString(reader);
     for (int x = 0; x < _contactPoints.Count; x++)
     {
         ContactPoints.AddNew();
         ContactPoints[x].Read(reader);
     }
     for (int x = 0; x < _contactPoints.Count; x++)
     {
         ContactPoints[x].ReadChildData(reader);
     }
 }
Esempio n. 4
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                _dONTUSE.ReadString(reader);
                _footsteps.ReadString(reader);
                for (x = 0; (x < _contactPoints.Count); x = (x + 1))
                {
                    ContactPoints.Add(new ContactPointBlock());
                    ContactPoints[x].Read(reader);
                }
                for (x = 0; (x < _contactPoints.Count); x = (x + 1))
                {
                    ContactPoints[x].ReadChildData(reader);
                }
            }
Esempio n. 5
0
        private void CalculateContactPoints()
        {
            upContactPoints    = new ContactPoints[horizontalDetectPointCount];
            downContactPoints  = new ContactPoints[horizontalDetectPointCount];
            leftContactPoints  = new ContactPoints[verticalDetectPointCount];
            rightContactPoints = new ContactPoints[verticalDetectPointCount];

            float xMin = collider.offset.x - (collider.size.x / 2);
            float xMax = collider.offset.x + (collider.size.x / 2);
            float yMin = collider.offset.y - (collider.size.y / 2);
            float yMax = collider.offset.y + (collider.size.y / 2);

            for (int i = 0; i < horizontalDetectPointCount; i++)
            {
                upContactPoints[i] = new ContactPoints(
                    new Vector2(Mathf.Lerp(xMin, xMax, i / (horizontalDetectPointCount - 1f)), yMax),
                    new Vector2(0, upRayDis)
                    );

                downContactPoints[i] = new ContactPoints(
                    new Vector2(Mathf.Lerp(xMin, xMax, i / (horizontalDetectPointCount - 1f)), yMin),
                    new Vector2(0, -downRayDis)
                    );
            }

            for (int i = 0; i < verticalDetectPointCount; i++)
            {
                leftContactPoints[i] = new ContactPoints(
                    new Vector2(xMin, Mathf.Lerp(yMin, yMax, i / (verticalDetectPointCount - 1f))),
                    new Vector2(-leftRayDis, 0)
                    );

                rightContactPoints[i] = new ContactPoints(
                    new Vector2(xMax, Mathf.Lerp(yMin, yMax, i / (verticalDetectPointCount - 1f))),
                    new Vector2(rightRayDis, 0)
                    );
            }
        }
        public async Task <IActionResult> UpdatePartyContactPoints([FromRoute] long applicationNumber, [FromRoute] int partyId, [FromBody] ContactPoints contactPoints)
        {
            try
            {
                bool auditLog     = AuditLog();
                var  updatedParty = await _involvedPartyRepository.UpdatePartyContactPoints(applicationNumber, partyId, contactPoints, auditLog);

                if (updatedParty != null)
                {
                    return(Ok());
                }
                return(NoContent());
            }
            catch (InvalidDataException e)
            {
                return(BadRequest(new { message = e.Message }));
            }
        }
Esempio n. 7
0
        public override void Update(float dt)
        {
            base.Update(dt);
            if (!IsOnGround)
            {
                if (CanIJump)
                {
                    _isStartingJump = false;
                }
                _timeSinceNotGround += dt;
            }

            if (IsOnGround)
            {
                _isStartingJump     = false;
                _timeSinceNotGround = 0;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.A) && Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                if (CanIJump)
                {
                    Jump(_defaultJumpHeight);

                    _isStartingJump = true;
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.A) || Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                var isLeftMove = Keyboard.GetState().IsKeyDown(Keys.A);
                IsSeeingLeft = isLeftMove;
                var velocity      = Body.GetLinearVelocity();
                var moveDirection = isLeftMove ? -1 : 1;

                if ((moveDirection < 0 && velocity.X > 0) || (moveDirection > 0 && velocity.X < 0))
                {
                    velocity.X = 0;
                }

                if (!IsOnGround || _isStartingJump)
                {
                    velocity.X += dt * moveDirection * _accelerationX;

                    if (Math.Abs(velocity.X) > _maxVelocity)
                    {
                        velocity.X = moveDirection * _maxVelocity;
                    }
                }
                else if (IsOnGround)
                {
                    var contactPoint = ContactPoints.First(point => point.Normal.Y > 0);
                    var normal       = contactPoint.Normal;

                    var rotateAngle     = (isLeftMove ? 1 : -1) * (float)Math.PI / 2f;
                    var directionVector = normal.Rotate(rotateAngle);

                    var acceleration = _accelerationX * (1 + _lovelyzK * directionVector.Y);
                    var speedVector  = acceleration * directionVector;

                    velocity += dt * speedVector;

                    if (Math.Abs(velocity.X) > Math.Abs(_maxVelocity * directionVector.X))
                    {
                        velocity.X = _maxVelocity * directionVector.X;
                    }
                    if (Math.Abs(velocity.Y) > Math.Abs(_maxVelocity * directionVector.Y))
                    {
                        velocity.Y = _maxVelocity * directionVector.Y;
                    }
                }
                Body.SetLinearVelocity(velocity);
            }

            if (Keyboard.GetState().IsKeyUp(Keys.A) && Keyboard.GetState().IsKeyUp(Keys.Right))
            {
                var velocity = Body.GetLinearVelocity();

                if (velocity.X != 0)
                {
                    velocity.X = 0;
                    Body.SetLinearVelocity(velocity);
                }
            }
        }