Ejemplo n.º 1
0
    /// <summary>
    /// Construct the item in the build order.
    /// </summary>
    public void BuildItem()
    {
        // TODO: Need to check if item can be built at this spot

        CItem blueprint = mWorld.GetEntity <CItem>(mOrder.mItemBlueprintID);

        blueprint.UpdatePlaceability();
        if (blueprint.mPlaceable)
        {
            Vector3 pos = CItem.CalculateBounds(blueprint.mPosition, blueprint.mItemRot, blueprint.mAsset.mWidth, blueprint.mAsset.mLength).center;
            pos.y = 0.0f;
            mWorld.AddTransientEventFOW(new Vector2(pos.x, pos.z)).SetEffect(pos);

            mWorld.PromoteBlueprintToItem(blueprint);

            // Dispose of the carried pickup.
            mWorld.DespawnEntity(mCarryingPickup);
            mCarryingPickup = null;
        }
        else
        {
            mWorld.DespawnEntity(blueprint);
            DropPickup();
        }

        // Tell order we are done with it.
        mOrder.OnCompleted();
        mOrder = null;
        //AdjustStamina(-CGame.Datastore.mGame.mBuildStamina);
    }