private void ComputeRowAndCol(MVector3D mousePos, out int row, out int col) { MVector3D worldPos = _inputDrive.ScreenToWorldPoint(mousePos); col = (int)Math.Floor(worldPos.x - (_contexts.game.GetStartPosX() - 0.5)); row = (int)Math.Floor(worldPos.y - (_contexts.game.GetStartPosY() - 0.5)); }
protected override void BodyPartsUpdate(MVector3D first, MVector3D second) { var imaginedLine = second - first; this.NotifyRotation( this.GetAngleOnX(imaginedLine.Y, imaginedLine.Z), this.GetAngleOnY(imaginedLine.X, imaginedLine.Z), this.GetAngleOnZ(imaginedLine.X, imaginedLine.Y)); }
public void Execute() { if (_inputDrive.GetMouseButtonDown(0)) { MVector3D vector3D = _inputDrive.MousePosition(); int row; int col; ComputeRowAndCol(vector3D, out row, out col); if (_contexts.game.getEntityByRowAndCol(row, col) != null) { _contexts.game.CreateEntity().AddClickStar(row, col); } } }
public RelativeMove RelativeTo(MVector3D position) { this._centerPosition = position; return this; }
internal RelativeMove(MoveableBodyPart moveable) { this._moveable = moveable; this._centerPosition = null; }
public MVector3D ScreenToWorldPoint(MVector3D vector3D) { Vector3 vector3 = vector3D.ToUnityVector3(); return(new MVector3D(Camera.main.ScreenToWorldPoint(vector3))); }
protected override void SkeletonUpdate(uint user, Skeleton s) { this.FirstPartPosition = this._bodyParts.GetFirstBodyPart(s); this.SecondPartPosition = this._bodyParts.GetSecondBodyPart(s); this.BodyPartsUpdate(this.FirstPartPosition, this.SecondPartPosition); }
protected abstract void BodyPartsUpdate(MVector3D first, MVector3D second);
private void DetermineIfAndHandleMove(MVector3D delta) { bool anyMove = this.HandleMovements(delta); if (this._lastWasMove && !anyMove) this.NoSignificantMovement(); this._lastWasMove = anyMove; }
private bool HandleMovements(MVector3D delta) { bool anyMove = false; anyMove |= Condition(delta.X >= this.Settings.XMoveThreshold, this.MoveRight); anyMove |= Condition(delta.X <= -this.Settings.XMoveThreshold, this.MoveLeft); anyMove |= Condition(delta.Y >= this.Settings.YMoveThreshold, this.MoveDown); anyMove |= Condition(delta.Y <= -this.Settings.YMoveThreshold, this.MoveUp); anyMove |= Condition(delta.Z >= this.Settings.ZMoveThreshold, this.Pull); anyMove |= Condition(delta.Z <= -this.Settings.ZMoveThreshold, this.Push); return anyMove; }
private void HandleDelta(MVector3D delta) { this.DetermineIfAndHandleMove(delta); this.IsMoving(); }