Esempio n. 1
0
        public void OnUse(TerrainRaycastResult terrainRaycastResult)
        {
            Point3          position = terrainRaycastResult.CellFace.Point;
            ComponentPlayer Player   = this.componentMiner.ComponentPlayer;

            if (!OnTouch.Touch(this, position))
            {
                return;
            }
            int cellValue = GameManager.Project.FindSubsystem <SubsystemTerrain>(true).Terrain.GetCellValue(position.X, position.Y, position.Z);
            int light     = Terrain.ExtractLight(cellValue);
            int data      = Terrain.ExtractData(cellValue);
            int contents  = Terrain.ExtractContents(cellValue);

            if (BlocksManager.Blocks[contents] != null)
            {
                if (numberPoint == NumberPoint.One)
                {
                    this.Position[0] = position;
                    Player.ComponentGui.DisplaySmallMessage($"坐标1设置完成\n X:{position.X} ,Y:{position.Y} ,Z:{position.Z}\n方块ID : {contents}\n方块完整值 : {cellValue}\n特殊值一 : {light} , 特殊值二 : {data} \n", true, false);
                    if (amountPoint != numberPoint)
                    {
                        numberPoint = NumberPoint.Two;
                    }
                }
                else if (numberPoint == NumberPoint.Two)
                {
                    this.Position[1] = position;
                    Player.ComponentGui.DisplaySmallMessage($"坐标2设置完成\n X:{position.X} ,Y:{position.Y} ,Z:{position.Z}\n方块ID : {contents}\n方块完整值 : {cellValue}\n特殊值一 : {light} , 特殊值二 : {data}\n", true, false);
                    if (amountPoint == numberPoint)
                    {
                        numberPoint = NumberPoint.One;
                    }
                    else
                    {
                        numberPoint = NumberPoint.Three;
                    }
                }
                else if (numberPoint == NumberPoint.Three)
                {
                    this.Position[2] = position;
                    Player.ComponentGui.DisplaySmallMessage($"坐标3设置完成\n X:{position.X} ,Y:{position.Y} ,Z:{position.Z}\n方块ID : {contents}\n方块完整值 : {cellValue}\n特殊值一 : {light} , 特殊值二 : {data}\n", true, false);
                    if (amountPoint == numberPoint)
                    {
                        numberPoint = NumberPoint.One;
                    }
                    else
                    {
                        numberPoint = NumberPoint.Four;
                    }
                }
                else if (numberPoint == NumberPoint.Four)
                {
                    this.Position[3] = position;
                    Player.ComponentGui.DisplaySmallMessage($"坐标4设置完成\n X:{position.X} ,Y:{position.Y} ,Z:{position.Z}\n方块ID : {contents}\n方块完整值 : {cellValue}\n特殊值一 : {light} , 特殊值二 : {data}\n", true, false);
                    numberPoint = NumberPoint.One;
                }
            }
        }
Esempio n. 2
0
 public void UpdateRightPoint(NumberPoint previousPoint)
 {
     if (isFixed)
     {
         LeftPoint.UpdateLeftPoint(this);
     }
     else
     {
         UpdatePoint(previousPoint);
         RightPoint?.UpdateRightPoint(this);
     }
 }
Esempio n. 3
0
    private void InitializePoints()
    {
        NumberPoint previousPoint = null;

        for (int i = 0; i < transform.childCount; i += 1)
        {
            var point = transform.GetChild(i).GetComponent <NumberPoint>();
            point.LeftPoint = previousPoint;

            if (previousPoint != null)
            {
                previousPoint.RightPoint = point;
            }
            point.Initialize(width, this);
            points.Add(point);
            previousPoint = point;
        }

        results = new RaycastHit2D[points.Count];
        points.ForEach(i => i.UpdateRenderer());
    }
Esempio n. 4
0
    private void UpdatePoint(NumberPoint previousPoint)
    {
        var direction = (transform.position - previousPoint.transform.position).normalized;

        transform.position = previousPoint.transform.position + direction * controller.Distance;
    }