コード例 #1
0
        public IEnumerator FollowToDigPlace(Vector2Int coords, float speed, EDigDirection direction)
        {
            _playerController.Locked = true;
            Vector3 worldCoords = _worldGrid.GetCellCenterWorld((Vector3Int)coords);

            if (direction == EDigDirection.Left || direction == EDigDirection.Right)
            {
                worldCoords += new Vector3(0, _offsetY_playerCenter_cellCenter, 0);
            }

            float   lerpCoeff     = 0f;
            Vector3 startPosition = transform.position;

            _rigidbody.simulated = false;

            while (lerpCoeff <= 1f)
            {
                lerpCoeff += speed * Time.deltaTime;
                _playerController.transform.position = Vector3.Lerp(startPosition, worldCoords, lerpCoeff);
                yield return(null);
            }

            _digCompleted.Raise();
            _rigidbody.simulated     = true;
            _playerController.Locked = false;
        }
コード例 #2
0
 public TryDigEA(Vector2Int gridCoordinates, float drillSharpness, int drillPower, Vector3 startPosition, EDigDirection direction)
 {
     GridCoordinates = gridCoordinates;
     DrillSharpness  = drillSharpness;
     DrillPower      = drillPower;
     StartPosition   = startPosition;
     Direction       = direction;
 }
コード例 #3
0
 public AllowDigEA(TileType tile, Vector2Int place, float speed, float hardness, Vector3 playerPosition, EDigDirection direction)
 {
     Tile           = tile;
     Place          = place;
     Speed          = speed;
     Hardness       = hardness;
     PlayerPosition = playerPosition;
     Direction      = direction;
 }