コード例 #1
0
        protected override void OnRefresh()
        {
            bool enableTakeAll       = false;
            bool enableTakeContainer = false;

            if (ContainerDisplay.HasEnabler && Enabler.HasEnablerContainer)
            {
                ContainerName.text = "Contents of container:";
                WIStackContainer container = Enabler.EnablerContainer;
                IStackOwner      owner     = null;
                if (container.HasOwner(out owner) && owner.IsWorldItem)
                {
                    //the owner will be the world item
                    WorldItem containerWorldItem = container.Owner.worlditem;
                    ContainerDisplay.EnablerDisplay.DopplegangerProps.CopyFrom(containerWorldItem);
                    ContainerDisplay.RefreshRequest();
                    //now check to see if that world item belongs to a non-player group
                    ContainerName.text = "Contents of: " + containerWorldItem.DisplayName;
                    if (containerWorldItem.Group.HasOwner(out owner) && owner == Player.Local)
                    {
                        enableTakeAll = true;
                        if (containerWorldItem.CanEnterInventory)
                        {
                            enableTakeContainer = true;
                        }
                    }
                }
            }
            else
            {
                ContainerName.text = "(No container opened)";
            }
        }
コード例 #2
0
ファイル: FoodStuff.cs プロジェクト: yazici/FRONTIERS
        public override void PopulateOptionsList(List <WIListOption> options, List <string> message)
        {
            IStackOwner owner = null;

            if (worlditem.Group.HasOwner(out owner) && owner != Player.Local)
            {
                return;
            }

            if (!HasProps)
            {
                RefreshFoodStuffProps();
            }

            if (HasProps && WorldItems.IsOwnedByPlayer(worlditem))
            {
                if (Props.IsLiquid)
                {
                    options.Add(new WIListOption("Drink"));
                }
                else
                {
                    options.Add(new WIListOption("Eat"));
                }
            }
        }
コード例 #3
0
        public bool UseRemoveItemSkill(HashSet <string> removeItemSkillNames, ref IStackOwner useTarget)
        {
            //first get our local remove item skills
            //this list is populatd by WIScripts
            List <string> localRemoveItemSkills = RemoveItemSkills;

            for (int i = 0; i < localRemoveItemSkills.Count; i++)
            {
                removeItemSkillNames.Add(localRemoveItemSkills [i]);
            }
            //then get our owner remove item skills
            //this is populated by the owner's WIScripts
            useTarget = null;
            IStackOwner groupOwner = null;

            if (Group.HasOwner(out groupOwner))
            {
                useTarget = groupOwner;
                //make sure that we're not the owner of this group to prevent a loop
                if (useTarget.IsWorldItem && useTarget != this)
                {
                    useTarget.UseRemoveItemSkill(removeItemSkillNames, ref useTarget);
                }
            }
            return(removeItemSkillNames.Count > 0);
        }
コード例 #4
0
        public override void SetProperties()
        {
            DisplayMode             = SquareDisplayMode.Disabled;
            ShowDoppleganger        = false;
            DopplegangerMode        = WIMode.Stacked;
            DopplegangerProps.State = "Default";
            WorldItem worlditem = null;

            if (IsEnabled)
            {
                DisplayMode = SquareDisplayMode.Enabled;
                IStackOwner owner = null;
                if (mContainerToDisplay.HasOwner(out owner))
                {
                    IWIBase wiOwner = owner.worlditem;
                    DopplegangerProps.CopyFrom(wiOwner);
                    DopplegangerMode = WIMode.Stacked;
                    ShowDoppleganger = true;
                }
                else
                {
                    DisplayMode = SquareDisplayMode.Error;
                }
            }
            else if (ShowDefaultContainerWhenEmpty)
            {
                DisplayMode = SquareDisplayMode.Enabled;
                DopplegangerProps.CopyFrom(Container.DefaultContainerGenericWorldItem);
                DopplegangerMode = WIMode.Stacked;
                ShowDoppleganger = true;
            }
        }
コード例 #5
0
        public override bool Use(IItemOfInterest targetObject, int flavorIndex)
        {
            bool result = false;
            //the target object is going to be a container
            //get the group owner of the container
            IStackOwner owner = null;

            GUIManager.PostDanger("Stole item");
            GUIManager.PostDanger("Your crime was imperfect - traces were left behind.");
            GUIManager.PostDanger("Your reputation has suffered.");

            if (targetObject.worlditem.Group.HasOwner(out owner))
            {
                //Debug.Log ("Item has owner " + owner.DisplayName);
                //check if the owner can see the player
                //use a random skill etc.
                float skillUseValue = UnityEngine.Random.value;
                if (skillUseValue > Mathf.Max(State.NormalizedUsageLevel, Globals.SkillFailsafeMasteryLevel))
                {
                    OnFailure();
                    result = false;
                }
                OnSuccess();
                result = true;
            }
            else
            {
                //if it has no owner then we're successful by default
                result = true;
            }
            return(result);
        }
コード例 #6
0
        public override bool Use(IItemOfInterest targetObject, int flavorIndex)
        {
            //first check if we're dealing directly with a barterable object
            IInventory barterInventory = targetObject.gameObject.GetComponent("IInventory") as IInventory;
            Container  container       = null;
            Character  character       = null;

            if (barterInventory == null)
            {
                //if not, check if we're dealing with an owned container
                if (targetObject.IOIType == ItemOfInterestType.WorldItem && targetObject.worlditem.Is <Container> (out container))
                {
                    //get the owner of the container
                    IStackOwner owner = null;
                    if (targetObject.worlditem.Group.HasOwner(out owner) && owner.IsWorldItem)
                    {
                        barterInventory = (IInventory)owner.worlditem.GetComponent(typeof(IInventory));
                    }
                    else                        //if the owner isn't a world item then it hasn't been loaded
                                                //TODO handle unloaded shop owners
                    {
                    }
                    character = owner.worlditem.Get <Character> ();
                }
            }
            else
            {
                character = targetObject.worlditem.Get <Character> ();
            }

            if (character != null)
            {
                ReputationState rep = Profile.Get.CurrentGame.Character.Rep.GetReputation(character.worlditem.FileName);
                if (rep.NormalizedReputationDifference(Profile.Get.CurrentGame.Character.Rep.GlobalReputation) > Extensions.MaxNormaliedReputationDifference)
                {
                    GUIManager.PostWarning(character.worlditem.DisplayName + " is not interested in bartering with you.");
                    return(false);
                }
            }

            if (barterInventory != null)
            {
                if (mCurrentSession == null)
                {
                    mCurrentSession = new BarterSession(this, mCharacterGoods, mPlayerGoods);
                }
                mCurrentSession.Reset(Player.Local.Inventory, barterInventory);
                mCurrentSession.BarteringCharacter = character;
                if (flavorIndex > 0)
                {
                    //flavor 0 is default mode
                    //flavor 1 is zero cost mode (friends, multiplayer, etc)
                    mCurrentSession.ZeroCostMode = true;
                }
                SpawnBarterDialog();
                return(true);
            }
            return(false);
        }
コード例 #7
0
        public override void TryToRemoveItem(IStackOwner skillUseTarget, WIStack fromStack, WIStack toStack, WIGroup toGroup, Action callBack, int flavor)
        {
            //instead of attempting to remove it now
            //this skill launched the barter dialog
            //and sets up a session
            WorldItem worldItem = null;

            Stacks.Convert.TopItemToWorldItem(fromStack, out worldItem);
            IWIBase    worldItemToMove = worldItem;
            IInventory barterInventory = null;
            Character  character       = null;

            //this only works with character-owned items
            if (skillUseTarget.IsWorldItem && skillUseTarget.worlditem.Is <Character> (out character))
            {
                barterInventory = character;
                //make sure we can actually barter with the player
                ReputationState rep = Profile.Get.CurrentGame.Character.Rep.GetReputation(character.worlditem.FileName);
                if (rep.NormalizedReputationDifference(Profile.Get.CurrentGame.Character.Rep.GlobalReputation) > Extensions.MaxNormaliedReputationDifference)
                {
                    GUIManager.PostWarning(character.worlditem.DisplayName + " is not interested in bartering with you.");
                    return;
                }

                if (mCurrentSession == null)
                {
                    mCurrentSession = new BarterSession(this, mCharacterGoods, mPlayerGoods);
                }
                mCurrentSession.Reset(Player.Local.Inventory, barterInventory);
                mCurrentSession.BarteringCharacter = character;
                //add the selected goods to the current session immediately
                //so it's there when we start bartering
                mCurrentSession.CharacterStartupItem = worldItemToMove;
                //if the startup item is already in the character's inventory
                //no need to create a startup stack
                //but if it isn't we'll need the startup stack to display it
                WIStack startupStack = null;
                if (!character.HasItem(worldItemToMove, out startupStack))
                {
                    Debug.Log("Item " + worldItemToMove.FileName + " was NOT in character's inventory, creating temporary startup stack");
                    if (fromStack.NumItems == 1)
                    {
                        //just hold the one item
                        mCurrentSession.CharacterStartupStack = character.HoldTemporaryItem(worldItemToMove);
                    }
                    else
                    {
                        mCurrentSession.CharacterStartupStack = character.HoldTemporaryItem(fromStack);
                    }
                }
                else
                {
                    Debug.Log("Item " + worldItemToMove.FileName + " was in character's inventory");
                    mCurrentSession.CharacterStartupStack = startupStack;
                }
                SpawnBarterDialog();
            }
        }
コード例 #8
0
 public virtual bool HasOwner(out IStackOwner owner)
 {
     owner = null;
     if (BelongsToContainer)
     {
         return(Container.HasOwner(out owner));
     }
     return(false);
 }
コード例 #9
0
        public void OnAddedToGroup()
        {
            //see if there are any flags we need to inherit
            IStackOwner owner = null;

            if (worlditem.Group.HasOwner(out owner))
            {
                if (owner == Player.Local)
                {
                    //we've been added to the player inventory
                    //don't bother to fill
                    Finish();
                    return;
                }

                Structure structure = null;
                if (owner.IsWorldItem && owner.worlditem.Is <Structure> (out structure))
                {
                    State.Flags.Union(structure.State.StructureFlags);
                }
            }

            mIsFilling = false;
            worlditem.OnAddedToPlayerInventory += OnAddedToPlayerInventory;
            worlditem.OnModeChange             += OnModeChange;
            worlditem.OnVisible += OnVisible;
            worlditem.OnActive  += OnVisible;

            if (Flags.Check((uint)ContainerFillTime.OnDie, (uint)State.FillTime, Flags.CheckType.MatchAny))
            {
                Damageable damageable = null;
                if (worlditem.Is <Damageable> (out damageable))
                {
                    damageable.OnDie += OnDie;
                }
            }

            //if this is a character then we'll want to filter our flags with the character flags
            Character character = null;

            if (worlditem.Is <Character> (out character))
            {
                State.Flags.Union(character.State.Flags);
                character.OnAccessInventory += OnOpenContainer;
                if (character.HasBank)
                {
                    mBankToFill = character.InventoryBank;
                }
            }
        }
コード例 #10
0
ファイル: RemoveItemSkill.cs プロジェクト: yazici/FRONTIERS
 public virtual void TryToRemoveItem(IStackOwner skillUseTarget, IWIBase itemToMove, IInventory toInventory, Action callBack, int flavor)
 {
     LastFromStack  = null;
     LastToStack    = null;
     LastItemToMove = itemToMove;
     LastInventory  = toInventory;
     LastCallback   = callBack;
     if (!CheckForSkillImmunity(itemToMove, this, out mImmunityMessage))
     {
         GUIManager.PostDanger(mImmunityMessage);
         FailImmediately();
         return;
     }
     //use the skill against the target
     Use(skillUseTarget.worlditem, LastSkillFlavor);
 }
コード例 #11
0
ファイル: Trigger.cs プロジェクト: yazici/FRONTIERS
 public override void OnInitialized()
 {
     worlditem.OnPlayerUse += OnPlayerUse;
     //if we're in a parent strucutre, add ourseles to the structure
     if (RemoteTrigger)
     {
         IStackOwner owner = null;
         if (worlditem.Group.HasOwner(out owner) && owner.IsWorldItem)
         {
             Structure structure = null;
             if (owner.worlditem.Is <Structure>(out structure))
             {
                 structure.AddDynamicTrigger(this);
             }
         }
     }
 }
コード例 #12
0
ファイル: RemoveItemSkill.cs プロジェクト: yazici/FRONTIERS
 public virtual void TryToRemoveItem(IStackOwner skillUseTarget, WIStack fromStack, WIStack toStack, WIGroup toGroup, Action callBack, int flavor)
 {
     LastInventory = null;
     LastFromStack = fromStack;
     LastToStack   = toStack;
     LastToGroup   = toGroup;
     LastCallback  = callBack;
     //make sure the item we're moving isn't immune to our skill
     if (!CheckForSkillImmunity(fromStack.TopItem, this, out mImmunityMessage))
     {
         GUIManager.PostDanger(mImmunityMessage);
         FailImmediately();
         return;
     }
     //use the skill against the target
     Use(skillUseTarget.worlditem, LastSkillFlavor);
 }
コード例 #13
0
        protected IEnumerator PlaceItemOverTime(WorldItem itemToPlace)
        {
            bool addToReceptacle = true;
            //check and see if this will result in a change of ownership
            //if it will, confirm before placing
            IStackOwner owner = null;

            if (worlditem.StackContainer.HasOwner(out owner) && owner != Player.Local)
            {
                //send a dialog to confirm the player wants to do this
                mResult = null;
                if (!Profile.Get.CurrentPreferences.HideDialogs.Contains("TransferOwnership"))
                {
                    //show the dialog explaining what happens
                    YesNoCancelDialogResult editObject = new YesNoCancelDialogResult();
                    editObject.CancelButton             = false;
                    editObject.DontShowInFutureCheckbox = true;
                    editObject.DialogName  = "TransferOwnership";
                    editObject.MessageType = "Transfer Ownership";
                    editObject.Message     = "If you do this, the item will be owned by someone else.\nAdd item to container?";

                    GameObject childEditor = GUIManager.SpawnNGUIChildEditor(gameObject, GUIManager.Get.NGUIYesNoCancelDialog, false);
                    GUIManager.SendEditObjectToChildEditor <YesNoCancelDialogResult> (new ChildEditorCallback <YesNoCancelDialogResult> (ReceiveFromChildEditor), childEditor, editObject);

                    while (mResult == null)
                    {
                        yield return(null);
                    }

                    if (mResult.Result != DialogResult.Yes)
                    {
                        addToReceptacle = false;
                    }
                }
            }

            if (addToReceptacle)
            {
                AddToReceptacle(itemToPlace);
            }
            yield break;
        }
コード例 #14
0
ファイル: Potions.cs プロジェクト: yazici/FRONTIERS
 public static void InitializeAvatar(PotionAvatar potionAvatar)
 {
     try {
         Potion potion = null;
         if (string.IsNullOrEmpty(potionAvatar.State.PotionName))
         {
             //get a potion name - start by getting the potion's flags
             WIFlags     flags       = null;
             IStackOwner potionOwner = null;
             if (potionAvatar.worlditem.Group.HasOwner(out potionOwner))
             {
                 WorldItem worlditem = null;
                 if (potionOwner.IsWorldItem)
                 {
                     Structure structure = null;
                     City      city      = null;
                     if (potionOwner.worlditem.Is <Structure>(out structure))
                     {
                         flags = structure.State.StructureFlags;
                     }
                     else if (potionOwner.worlditem.Is <City>(out city))
                     {
                         flags = city.State.StructureFlags;
                     }
                 }
             }
             //if we couldn't find the flags
             if (flags == null)
             {
                 //just get the chunk flags
                 WorldChunk chunk = potionAvatar.worlditem.Group.GetParentChunk();
                 flags = GameWorld.Get.CurrentRegion.StructureFlags;
             }
             potion                        = Get.RandomPotion(flags);
             potionAvatar.Props            = potion;
             potionAvatar.State.PotionName = potion.Name;
             potionAvatar.worlditem.Props.Local.Subcategory = potion.Name;
         }
         else
         {
             if (mPotionLookup.TryGetValue(potionAvatar.State.PotionName, out potion))
             {
                 potionAvatar.Props = potion;
             }
         }
         //potion is guaranteed to return a health potion
         //potions are guaranteed to have one renderer
         Renderer renderer       = potionAvatar.worlditem.Renderers[0];
         Material potionMaterial = new Material(renderer.sharedMaterial);                                                //instance the material
         potionMaterial.SetColor("_SkinColor", Colors.Get.ColorFromFlagset(potion.PotionType, "PotionType"));
         potionMaterial.SetColor("_EyeColor", Colors.Get.ByName(potion.ContainerColor));
         if (potion.UseCustomColor)
         {
             potionMaterial.SetColor("_HairColor", potion.CustomPotionColor);
         }
         else
         {
             potionMaterial.SetColor("_EyeColor", Colors.Get.ByName(potion.PotionColor));
         }
     } catch (Exception e) {
         Debug.LogError("Error when initializing potion: " + e.ToString());
     }
 }
コード例 #15
0
        public override void TryToRemoveItem(IStackOwner skillUseTarget, IWIBase worldItemToMove, IInventory toInventory, Action callBack, int flavor)
        {
            //instead of attempting to remove it now
            //this skill launched the barter dialog
            //and sets up a session
            if (flavor == BuyFlavor)
            {
                int baseCurrencyValue = Mathf.CeilToInt(worldItemToMove.BaseCurrencyValue);
                if (Player.Local.Inventory.InventoryBank.CanAfford(baseCurrencyValue))
                {
                    Player.Local.Inventory.InventoryBank.TryToRemove(baseCurrencyValue);
                    worldItemToMove.Add("OwnedByPlayer");
                    WIStackError error = WIStackError.None;
                    if (!Player.Local.Inventory.AddItems(worldItemToMove, ref error))
                    {
                        Player.Local.ItemPlacement.ItemForceCarry(worldItemToMove.worlditem);
                    }
                    //improve rep with shopkeeper
                    Profile.Get.CurrentGame.Character.Rep.GainPersonalReputation(skillUseTarget.FileName, skillUseTarget.DisplayName, Globals.ReputationChangeTiny);
                    return;
                }
                else
                {
                    GUIManager.PostInfo("You can't afford that.");
                    return;
                }
            }
            else
            {
                IInventory barterInventory = null;
                Character  character       = null;
                //this only works with character-owned items
                if (skillUseTarget.IsWorldItem && skillUseTarget.worlditem.Is <Character> (out character))
                {
                    barterInventory = character;
                    //make sure we can actually barter with the player
                    ReputationState rep = Profile.Get.CurrentGame.Character.Rep.GetReputation(character.worlditem.FileName);
                    if (rep.NormalizedReputationDifference(Profile.Get.CurrentGame.Character.Rep.GlobalReputation) > Extensions.MaxNormaliedReputationDifference)
                    {
                        GUIManager.PostWarning(character.worlditem.DisplayName + " is not interested in bartering with you.");
                        return;
                    }

                    if (mCurrentSession == null)
                    {
                        mCurrentSession = new BarterSession(this, mCharacterGoods, mPlayerGoods);
                    }
                    mCurrentSession.Reset(Player.Local.Inventory, barterInventory);
                    mCurrentSession.BarteringCharacter = character;
                    //add the selected goods to the current session immediately
                    //so it's there when we start bartering
                    mCurrentSession.CharacterStartupItem = worldItemToMove;
                    WIStack startupStack = null;
                    //if the startup item is already in the character's inventory
                    //no need to create a startup stack
                    //but if it isn't we'll need the startup stack to display it
                    if (!character.HasItem(worldItemToMove, out startupStack))
                    {
                        //TODO put entire container in inventory
                        Debug.Log("Item " + worldItemToMove.FileName + " was NOT in character's inventory, creating temporary startup stack");
                        mCurrentSession.CharacterStartupStack = character.HoldTemporaryItem(worldItemToMove);
                    }
                    SpawnBarterDialog();
                }
            }
        }
コード例 #16
0
ファイル: Bed.cs プロジェクト: yazici/FRONTIERS
        public override void PopulateOptionsList(List <WIListOption> options, List <string> message)
        {
            mSleptManually = false;

            if (!string.IsNullOrEmpty(RequiredState) && worlditem.State != RequiredState)
            {
                return;
            }

            if (!CanBeUsedManually || !State.HasBeenActivated)
            {
                return;
            }
            RequiresPayment = false;
            CostOfUse       = 0;

            IStackOwner owner = null;

            if (worlditem.Group.HasOwner(out owner) && owner.IsWorldItem)
            {
                owner.worlditem.Is <InnKeeper>(out ParentInkeeper);
                owner.worlditem.Is <Character>(out ParentResident);
            }

            if (HasParentInnkeeper)
            {
                if (!ParentInkeeper.HasPaid)
                {
                    RequiresPayment = true;
                    CostOfUse       = ParentInkeeper.PricePerNight;
                }
            }
            else if (HasParentResident)
            {
                //we can only sleep in residence houses if we know the character
                if (!Characters.KnowsPlayer(ParentResident.worlditem.FileName))
                {
                    return;
                }
            }

            WIListOption dawn = new WIListOption("Sleep 'til Dawn", "Dawn");

            if (WorldClock.IsTimeOfDay(TimeOfDay.ad_TimeDawn) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                dawn.Disabled = true;
            }
            options.Add(dawn);

            WIListOption noon = new WIListOption("Sleep 'til Noon", "Noon");

            if (WorldClock.IsTimeOfDay(TimeOfDay.ag_TimeNoon) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                noon.Disabled = true;
            }
            options.Add(noon);

            WIListOption dusk = new WIListOption("Sleep 'til Dusk", "Dusk");

            if (WorldClock.IsTimeOfDay(TimeOfDay.aj_TimeDusk) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                dusk.Disabled = true;
            }
            options.Add(dusk);

            WIListOption midnight = new WIListOption("Sleep 'til Midnight", "Midnight");

            if (WorldClock.IsTimeOfDay(TimeOfDay.aa_TimeMidnight) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                midnight.Disabled = true;
            }
            options.Add(midnight);

            if (RequiresPayment)
            {
                dawn.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                noon.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                dusk.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                midnight.RequiredCurrencyType = WICurrencyType.A_Bronze;

                dawn.CurrencyValue     = CostOfUse;
                noon.CurrencyValue     = CostOfUse;
                dusk.CurrencyValue     = CostOfUse;
                midnight.CurrencyValue = CostOfUse;
            }
        }
コード例 #17
0
 public WIStackContainer GetDuplicate(IStackOwner owner)
 {
     return(new WIStackContainer(owner));
 }
コード例 #18
0
 public WIStackContainer(IStackOwner owner)
 {
     mOwner = owner;
     mRefreshContainerAction = Refresh;
 }
コード例 #19
0
ファイル: PlayerBase.cs プロジェクト: yazici/FRONTIERS
 public virtual bool UseRemoveItemSkill(HashSet <string> removeItemSkillNames, ref IStackOwner useTarget)
 {
     return(false);
 }
コード例 #20
0
ファイル: Creature.cs プロジェクト: yazici/FRONTIERS
        public void OnAddedToGroup()
        {
            //save so the creature den spawner won't get confused
            //WorldItems.Get.Save(worlditem, true);
            //initialize the body parts
            //Body.Initialize (worlditem);
            //add the body's renderers to worlditem renderers
            //so they're disabled when appropriate
            //worlditem.Renderers.AddRange (Body.Renderers);

            if (Den == null)
            {
                IStackOwner owner = null;
                if (worlditem.Group.HasOwner(out owner))
                {
                    Den = (ICreatureDen)owner.worlditem.GetComponent(typeof(ICreatureDen));
                    //else - we don't have a den so we'll set default roaming distance from props
                }
            }
            if (Den != null)
            {
                Den.AddCreature(this.worlditem);
            }

            //set up the collective thought object
            CurrentThought.OnFleeFromIt += FleeFromThing;
            CurrentThought.OnKillIt     += AttackThing;
            CurrentThought.OnEatIt      += EatThing;
            CurrentThought.OnFollowIt   += FollowThing;
            CurrentThought.OnWatchIt    += WatchThing;
            //CurrentThought.OnMateWithIt += MateWithThing;

            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                //create motile behaviors
                //TODO create more logical behaviors for creatures without a den
                mFollowAction            = new MotileAction();
                mFollowAction.Name       = "Follow action by Creature";
                mFollowAction.Type       = MotileActionType.FollowTargetHolder;
                mFollowAction.FollowType = MotileFollowType.Follower;
                mFollowAction.Expiration = MotileExpiration.TargetOutOfRange;
                mFollowAction.OutOfRange = Den.Radius;
                mFollowAction.Range      = Den.Radius;
                //mFollowAction.TerritoryType = MotileTerritoryType.Den;
                mFollowAction.TerritoryBase = Den;

                mEatAction            = new MotileAction();
                mEatAction.Name       = "Eat action by Creature";
                mEatAction.Type       = MotileActionType.FollowGoal;
                mEatAction.Expiration = MotileExpiration.TargetInRange;
                mEatAction.Range      = Template.MotileTemplate.MotileProps.RVORadius * 2;
                //mEatAction.TerritoryType = MotileTerritoryType.Den;
                mEatAction.TerritoryBase = Den;

                mReturnToDenAction            = new MotileAction();
                mReturnToDenAction.Name       = "Return to Den action by Creature";
                mReturnToDenAction.Type       = MotileActionType.FollowGoal;
                mReturnToDenAction.Expiration = MotileExpiration.TargetInRange;
                mReturnToDenAction.Range      = Template.MotileTemplate.MotileProps.RVORadius;
                mReturnToDenAction.LiveTarget = Den.IOI;
                //mReturnToDenAction.TerritoryType = MotileTerritoryType.Den;
                mReturnToDenAction.TerritoryBase = Den;

                mFleeThreatAction               = new MotileAction();
                mFleeThreatAction.Name          = "Flee threat action by Creature";
                mFleeThreatAction.Type          = MotileActionType.FleeGoal;
                mFleeThreatAction.Expiration    = MotileExpiration.TargetOutOfRange;
                mFleeThreatAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                mFleeThreatAction.OutOfRange    = Den.Radius;
                mFleeThreatAction.Range         = Looker.AwarenessDistanceTypeToVisibleDistance(Template.LookerTemplate.AwarenessDistance);
                //mFleeThreatAction.TerritoryType = MotileTerritoryType.Den;
                mFleeThreatAction.TerritoryBase = Den;

                mPursueGoalAction               = new MotileAction();
                mPursueGoalAction.Name          = "Pursue goal action by Creature";
                mPursueGoalAction.Type          = MotileActionType.FollowGoal;
                mPursueGoalAction.Expiration    = MotileExpiration.TargetInRange;
                mPursueGoalAction.YieldBehavior = MotileYieldBehavior.YieldAndWait;
                mPursueGoalAction.Range         = Template.MotileTemplate.MotileProps.RVORadius;
                //mPursueGoalAction.TerritoryType = MotileTerritoryType.Den;
                mPursueGoalAction.TerritoryBase = Den;

                mFocusAction               = new MotileAction();
                mFocusAction.Name          = "Focus action by Creature";
                mFocusAction.Type          = MotileActionType.FocusOnTarget;
                mFocusAction.Expiration    = MotileExpiration.Duration;
                mFocusAction.RTDuration    = ShortTermMemoryToRT(Template.Props.ShortTermMemory);
                mFocusAction.YieldBehavior = MotileYieldBehavior.YieldAndFinish;
                //mFocusAction.TerritoryType = MotileTerritoryType.Den;
                mFocusAction.TerritoryBase = Den;

                mWanderAction            = motile.BaseAction;
                mWanderAction.Name       = "Base Action (wander) Set By Creature";
                mWanderAction.Type       = MotileActionType.WanderIdly;
                mWanderAction.LiveTarget = Den.IOI;
                //mWanderAction.TerritoryType = MotileTerritoryType.Den;
                mWanderAction.TerritoryBase = Den;
                mWanderAction.Range         = Den.Radius;
                mWanderAction.OutOfRange    = Den.Radius;

                if (!IsDead)
                {
                    motile.StartMotileActions();
                }
            }

            if (IsDead)
            {
                motile.IsRagdoll = true;
                Body.SetRagdoll(true, 0.1f);
                Body.transform.position = worlditem.transform.position + Vector3.up;
                Body.transform.Rotate(UnityEngine.Random.Range(0f, 360f), UnityEngine.Random.Range(0f, 360f), UnityEngine.Random.Range(0f, 360f));
                OnDie();
            }
            else
            {
                RefreshBehavior();
            }
        }
コード例 #21
0
 public bool UseRemoveItemSkill(HashSet <string> removeItemSkillNames, ref IStackOwner useTarget)
 {
     useTarget = null;
     return(false);
 }
コード例 #22
0
 public override bool HasOwner(out IStackOwner owner)
 {
     owner = mOwner;
     return(mOwner != null);
 }