Example #1
0
    private void CheckForMeleeCompletion()
    {
        if (GameDetails.ripostes != 0)
        {
            StartCoroutine(MyRiposte.FadeOut());
        }
        if (GameDetails.blocks != 0)
        {
            StartCoroutine(MyBlock.FadeOut());
        }
        if (GameDetails.hits != 0)
        {
            StartCoroutine(MyHit.FadeOut());
        }
        if (GameDetails.fullChargeHits != 0)
        {
            StartCoroutine(MyChargedHit.FadeOut());
        }
        if (EquipmentManager.instance.currentEquipment[4] != null)
        {
            StartCoroutine(equipShield.FadeOut());
        }
        if (EquipmentManager.instance.currentEquipment[3] != null)
        {
            StartCoroutine(equipSword.FadeOut());
        }

        if (GameDetails.ripostes != 0 && GameDetails.blocks != 0 && GameDetails.hits != 0 && GameDetails.fullChargeHits != 0)
        {
            if (MyRiposte.MyAlpha < 0.05f && MyBlock.MyAlpha < 0.05f && MyHit.MyAlpha < 0.05f && MyChargedHit.MyAlpha < 0.05f)
            {
                doneWithMelee = true;
            }
        }
    }
Example #2
0
 public ModifierContext(MyGridDataComponent data, MyBlock block, InterningBag <EquiModifierBaseDefinition> modifiers)
 {
     _a            = data;
     _b            = block;
     OriginalModel = GetOriginalBlockModel(data, block);
     Modifiers     = modifiers;
 }
Example #3
0
        private static string GetOriginalBlockModel(MyGridDataComponent gridData, MyBlock block)
        {
            var buildableDef = block.Definition as MyBuildableBlockDefinition;

            if (buildableDef == null)
            {
                return(block.Definition.Model);
            }
            var currentState = gridData.Container?.Get <MyGridBuildingComponent>()?.GetBlockState(block.Id);

            if (currentState == null)
            {
                return(block.Definition.Model);
            }

            var buildProgress = (float)currentState.BuildIntegrity / currentState.MaxIntegrity;

            for (var i = buildableDef.BuildProgressModels.Count - 1; i >= 0; i--)
            {
                var model = buildableDef.BuildProgressModels[i];
                if (buildProgress <= model.UpperBound)
                {
                    return(model.Model);
                }
            }

            return(block.Definition.Model);
        }
Example #4
0
        private static void InputExecutionToCode(ref string code, MyBlock block, int endID)
        {
            code += "          case(" + block.ID + "):" + Environment.NewLine;
            var temp = block.Code.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();

            for (int i = 0; i < temp.Count; i++)
            {
                code += "             " + temp[i] + Environment.NewLine;
            }
            code +=
                "              ID=" + endID + ";" + Environment.NewLine +
                "              break;" + Environment.NewLine;
        }
Example #5
0
 private static void DecisionToCode(ref string code, MyBlock block, ref ListCanvasLines lines)
 {
     code += "          case(" + block.ID + "):" + Environment.NewLine +
             "               " + block.Code + Environment.NewLine +
             //"               {" + Environment.NewLine +
             "                   ID=" + lines.Find(x => x.BeginId == block.ID && x.IsTrue).EndId + ";" +
             Environment.NewLine +
             //"               }" + Environment.NewLine +
             "               else" + Environment.NewLine +
             //"               {" + Environment.NewLine +
             "                   ID=" + lines.Find(x => x.BeginId == block.ID && !x.IsTrue).EndId + ";" +
             Environment.NewLine +
             //"               }" + Environment.NewLine +
             "              break;" + Environment.NewLine;
 }
Example #6
0
    public void RenderBlock(Block originBlock)
    {
        if (meshGenerator == null)
        {
            meshGenerator = GetComponent <ChunkMeshGenerator>();
        }
        if (meshGenerator == null)
        {
            return;
        }
        MyBlock blockOwner = new MyBlock(Vector3Int.zero, originBlock);

        meshGenerator.ChunkOrigin = Vector3Int.zero;
        meshGenerator.ChunkSize   = 1;
        meshGenerator.BlockOwner  = blockOwner;
        meshGenerator.GenerateMesh();
    }
Example #7
0
        private static void StartToCode(ref string code, MyBlock block, int startID)
        {
            code += block.Includes + Environment.NewLine + Environment.NewLine;
            code += "int main()" + Environment.NewLine +
                    "{" + Environment.NewLine +
                    "   int ID=" + startID + ";" + Environment.NewLine;
            var temp = block.Variables.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();

            for (int i = 0; i < temp.Count; i++)
            {
                code += "   " + temp[i] + Environment.NewLine;
            }
            code += "   while(true)" + Environment.NewLine +
                    "   {" + Environment.NewLine +
                    "       switch(ID)" + Environment.NewLine +
                    "       {" + Environment.NewLine;
        }
Example #8
0
    /// <summary>
    /// Creates the given block by constructing the Meshes that will be rendered, but only for the sides that
    /// have a solid neighbor.
    /// </summary>
    /// <param name="chunk">The parent chunk the block is in.</param>
    /// <param name="x">The x-coordinate position of the block to render.</param>
    /// <param name="y">The y-coordinate position of the block to render.</param>
    /// <param name="z">The z-coordinate position of the block to render.</param>
    private void RenderBlock(MyChunk chunk, int x, int y, int z)
    {
        MyBlock block = chunk.ChunkMetadata[x, y, z];

        if (block.BlockType == BlockType.AIR)
        {
            return;
        }

        foreach (CubeSide side in Enum.GetValues(typeof(CubeSide)))
        {
            if (!IsNeighboringBlockSolid(chunk, side, x, y, z))
            {
                block.CreateQuad(side);
            }
        }
    }
Example #9
0
 /// <summary>
 /// Creates the chunk metadata by constructing the unrealized blocks.  They will later be realized (i.e. Meshes will be
 /// created).
 /// </summary>
 /// <returns></returns>
 private MyBlock[,,] createChunkMetadata()
 {
     MyBlock[,,] chunkMetadata = new MyBlock[chunkSize, chunkSize, chunkSize];
     for (int z = 0; z < chunkSize; z++)
     {
         for (int y = 0; y < chunkSize; y++)
         {
             for (int x = 0; x < chunkSize; x++)
             {
                 Vector3 position      = new Vector3(x, y, z);
                 Vector3 worldPosition = position + chunkGameObject.transform.position;
                 chunkMetadata[x, y, z] = new MyBlock(
                     NoiseUtil.GetBlockAt(worldPosition),
                     position,
                     chunkGameObject.gameObject
                     );
             }
         }
     }
     return(chunkMetadata);
 }
Example #10
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //获取块参照插入点坐标
            double  insertPointX = Convert.ToDouble(this.textBoxInsertPointX.Text);
            double  insertPointY = Convert.ToDouble(this.textBoxInsertPointY.Text);
            double  insertPointZ = Convert.ToDouble(this.textBoxInsertPointZ.Text);
            Point3d insertPoint  = new Point3d(insertPointX, insertPointY, insertPointZ);
            //获取块参照的缩放比例
            double  scaleX = Convert.ToDouble(this.textBoxScaleX.Text);
            double  scaleY = Convert.ToDouble(this.textBoxScaleY.Text);
            double  scaleZ = Convert.ToDouble(this.textBoxScaleZ.Text);
            Scale3d scale  = new Scale3d(scaleX, scaleY, scaleZ);
            //获取块参照的旋转角度
            double rotationAngle = Convert.ToDouble(this.textBoxRotateAngle.Text);

            //关闭窗体
            this.Close();
            //插入块参照
            MyBlock myBlock = new MyBlock();

            myBlock.InsertBlockRef(this.comboBoxBlockName.Text, insertPoint, scale, rotationAngle);
        }
Example #11
0
 /// <summary>
 /// Konstruktor tworzący kontrolkę. Na podstawie MyBlock wyświetlane są wszystkie niezbędne pola dla użytkownika.
 /// </summary>
 /// <param name="block"></param>
 public BlockProperties(MyBlock block)
 {
     _block = block;
     PrepareControlView();
     _pg.SelectedObject = new PropertyGridItems(_block);
 }
Example #12
0
 /// <summary>
 /// Metoda zwracająca wartość typu bool. Zadaniem jej jest porównanie nowo zaznaczonego bloku z obecnie wyświetlanym.
 /// Jeżeli są takie same zwracana jest wartość true i kontrolka powinna zostać tylko zaktualizowana.
 /// </summary>
 /// <param name="newBlock"></param>
 /// <returns></returns>
 public bool ShouldRefresh(MyBlock newBlock)
 {
     return(newBlock == _block);
 }
Example #13
0
 public UndoRedoItem(MyAction myAction, MyBlock block, MyLine line)
 {
     MyActionType = myAction;
     Block        = block;
     Line         = line;
 }
Example #14
0
 /// <summary>
 /// Konstruktor tworzący uchwyt do zmiennej typu MyBlock (ref)
 /// </summary>
 /// <param name="block"></param>
 public PropertyGridItems(MyBlock block)
 {
     _block = null;
     _block = block;
 }