Exemple #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);
    }
Exemple #2
0
    /// <summary>
    /// The order could not be completed so we just abandon it.
    /// </summary>
    public void AbandonOrder()
    {
        // TODO: Should maybe tell the order about this and let it handle things.
        DropPickup();

        if (mOrder != null)
        {
            mOrder.OnAbandoned();
            mOrder = null;
        }
    }
Exemple #3
0
    public void SetBuildOrder(CBuildOrder Order)
    {
        if (!mCanAcceptTask || mOrder != null || Order == null)
        {
            Debug.LogError("Unit SetBuildOrder Problem.");
            return;
        }

        mOrder = Order;
        SetAction(CUnitActions.EType.TASK_BUILD);
    }