Exemple #1
0
    /**
     * Executing the upgrades
     */

    public override void Execute(MinEventParams _params)
    {
        if (GameManager.Instance.World == null)
        {
            return;
        }
        World world = GameManager.Instance.World;

        for (int i = 0; i < this.targets.Count; i++)
        {
            Log.Out("Checking for Entity");
            if (this.targets[i] as Entity == null)
            {
                Log.Out("Null, continue");
                continue;
            }

            Vector3i currentPosition = new Vector3i(this.targets[i].GetPosition());
            Dictionary <Vector3i, Block> blockPositions = CoordinateHelper.GetBlocksFromCoordinates(world, CoordinateHelper.GetCoOrdinatesAround(currentPosition, this.range));
            foreach (KeyValuePair <Vector3i, Block> entry in blockPositions)
            {
                Block blockToCheck = entry.Value;
                if (blockToCheck.GetBlockName() != this.blockName)
                {
                    continue;
                }

                BlockHelpers.DoBlockUpgrade(entry.Key, this.targets[i], this.requireMaterials);
            }
        }
    }