Пример #1
0
        public void AttackThing(IItemOfInterest itemOfInterest)
        {
            if (Profile.Get.CurrentGame.Difficulty.IsDefined("NoHostileCreatures"))
            {
                return;
            }

            Body.EyeMode = BodyEyeMode.Hostile;
            Hostile hostile = null;

            if (!worlditem.Is <Hostile> (out hostile))
            {
                hostile = worlditem.GetOrAdd <Hostile> ();
                //copy the properties quickly
                Reflection.CopyProperties(Template.HostileTemplate, hostile.State);
                //copy the attacks directly
                hostile.TerritoryBase   = Den;
                hostile.State.Attack1   = ObjectClone.Clone <AttackStyle> (Template.HostileTemplate.Attack1);
                hostile.State.Attack2   = ObjectClone.Clone <AttackStyle> (Template.HostileTemplate.Attack2);
                hostile.OnAttack1Start += OnAttack1;
                hostile.OnAttack2Start += OnAttack2;
                hostile.OnWarn         += OnWarn;
                hostile.OnCoolOff      += OnCoolOff;
            }
            if (!hostile.HasPrimaryTarget || hostile.PrimaryTarget != itemOfInterest)
            {
                hostile.PrimaryTarget = itemOfInterest;
            }
            hostile.RefreshAttackSettings();
            Body.Animator.Idling = false;
        }
Пример #2
0
        public bool AttackThingAction(IItemOfInterest itemOfInterest)
        {
            bool    result  = false;
            Hostile hostile = null;

            if (!worlditem.Is <Hostile> (out hostile))
            {
                hostile = worlditem.GetOrAdd <Hostile> ();
                //copy the properties quickly
                Reflection.CopyProperties(Template.HostileTemplate, hostile.State);
                //copy the attacks directly
                hostile.TerritoryBase   = TerritoryBase;
                hostile.State.Attack1   = ObjectClone.Clone <AttackStyle> (Template.HostileTemplate.Attack1);
                hostile.State.Attack2   = ObjectClone.Clone <AttackStyle> (Template.HostileTemplate.Attack2);
                hostile.OnAttack1Start += OnAttack1;
                hostile.OnAttack2Start += OnAttack2;
                hostile.OnWarn         += OnWarn;
                hostile.OnCoolOff      += OnCoolOff;
                result = true;
            }
            if (!hostile.HasPrimaryTarget || hostile.PrimaryTarget != itemOfInterest)
            {
                hostile.PrimaryTarget = itemOfInterest;
                result = true;
            }
            animator.Idling     = false;
            animator.WeaponMode = CharacterWeaponMode.BareHands;
            return(false);
        }
Пример #3
0
 public bool SurvivalHostileDeaggro(double timeStamp)
 {
     if (!Player.Local.Surroundings.HasHostiles)
     {
         Hostile hostile = null;
         if (worlditem.Is <Hostile> (out hostile))
         {
             hostile.Finish();
         }
     }
     return(true);
 }
Пример #4
0
 protected IEnumerator OnPlayerLeaveCamp()
 {
     for (int i = 0; i < SpawnedBandits.Count; i++)
     {
         Hostile hostile = null;
         if (SpawnedBandits [i].worlditem.Is <Hostile> (out hostile))
         {
             hostile.Finish();
         }
         yield return(null);
     }
     yield break;
 }
Пример #5
0
 public bool SurvivalHostileAggro(double timeStamp)
 {
     if (Player.Local.Surroundings.HasHostiles)
     {
         Hostile hostile = worlditem.GetOrAdd <Hostile> ();
         if (!hostile.HasPrimaryTarget)
         {
             //we're not currently attacking anything
             //so attack the first thing that's attacking the player
             IHostile target = Player.Local.Surroundings.Hostiles [0];
             hostile.PrimaryTarget = target.hostile;
         }
     }
     return(true);
 }