Esempio n. 1
0
    public override void ExecuteAction(ItemActionData _actionData, bool _bReleased)
    {
        FeedInventoryData feedInventoryData = (FeedInventoryData)_actionData;
        EntityAlive       entityAlive       = null;
        EntityAlive       holdingEntity     = feedInventoryData.invData.holdingEntity;

        feedInventoryData.ray = holdingEntity.GetLookRay();
        if (Voxel.Raycast(feedInventoryData.invData.world, feedInventoryData.ray, 4f, -538750981, 128, this.SphereRadius))
        {
            entityAlive = (ItemActionUseOther.GetEntityFromHit(Voxel.voxelRayHitInfo) as EntityAlive);
        }

        if (entityAlive != null)
        {
            foreach (string strCVar in this.lstTargetCvar)
            {
                Debug.Log("' Checking for CVAR: " + strCVar);
                if (entityAlive.Buffs.HasCustomVar(strCVar))
                {
                    if (entityAlive.Buffs.GetCustomVar(strCVar) > 100)
                    {
                        base.ExecuteAction(_actionData, _bReleased);
                        if (feedInventoryData.bFeedingStarted)
                        {
                            entityAlive.Buffs.SetCustomVar(strCVar, 0f, true);
                        }
                    }
                    return;
                }
            }
        }
        else
        {
            Debug.Log("No Target Entity");
        }
    }