// Token: 0x06001E68 RID: 7784 RVA: 0x001B23D4 File Offset: 0x001B05D4
 CreatureTemplate.Relationship IUseARelationshipTracker.UpdateDynamicRelationship(RelationshipTracker.DynamicRelationship dRelation)
 {
     if (dRelation.trackerRep.VisualContact)
     {
         dRelation.state.alive = dRelation.trackerRep.representedCreature.state.alive;
         if (dRelation.trackerRep.representedCreature.realizedCreature.grasps != null)
         {
             for (int i = 0; i < dRelation.trackerRep.representedCreature.realizedCreature.grasps.Length; i++)
             {
                 if (dRelation.trackerRep.representedCreature.realizedCreature.grasps[i] != null && dRelation.trackerRep.representedCreature.realizedCreature.grasps[i].grabbed is SeaDrake)
                 {
                     SocialMemory.Relationship orInitiateRelationship = this.fish.State.socialMemory.GetOrInitiateRelationship(dRelation.trackerRep.representedCreature.ID);
                     orInitiateRelationship.like = Mathf.Lerp(orInitiateRelationship.like, 0f, 5E-05f);
                     break;
                 }
             }
         }
     }
     CreatureTemplate.Relationship result = base.StaticRelationship(dRelation.trackerRep.representedCreature).Duplicate();
     return(result);
 }
示例#2
0
    public override void Collide(PhysicalObject otherObject, int myChunk, int otherChunk)
    {
        base.Collide(otherObject, myChunk, otherChunk);
        if (!base.Consious)
        {
            return;
        }
        float num = Vector2.Distance(base.bodyChunks[myChunk].vel, otherObject.bodyChunks[otherChunk].vel);

        if (otherObject is Player && num < 8f)
        {
            this.grabable = Math.Max(this.grabable, 7);
        }
        if (myChunk == 2 && num > 12f && otherObject is Creature && !(otherObject is SeaDrake))
        {
            (otherObject as Creature).Violence(base.bodyChunks[myChunk], new Vector2?(base.bodyChunks[myChunk].vel * base.bodyChunks[myChunk].mass), otherObject.bodyChunks[otherChunk], null, Creature.DamageType.Bite, 5f, 10f);
            this.room.PlaySound(SoundID.White_Lizard_Tongue_Shoot_Out, base.mainBodyChunk);
            Vector2 pos = base.bodyChunks[myChunk].pos + Custom.DirVec(base.bodyChunks[myChunk].pos, otherObject.bodyChunks[otherChunk].pos) * base.bodyChunks[myChunk].rad;
            for (int i = 0; i < 5; i++)
            {
                this.room.AddObject(new Bubble(pos, Custom.RNV() * 18f * UnityEngine.Random.value, false, false));
            }
            return;
        }
        if (myChunk == 2 && base.grasps[0] == null && this.AI.WantToEatObject(otherObject))
        {
            this.Grab(otherObject, 0, otherChunk, Creature.Grasp.Shareability.CanNotShare, 1f, true, true);
            this.room.PlaySound(SoundID.Vulture_Grab_Player, base.mainBodyChunk);
        }
        else if (!(otherObject is SeaDrake) && otherObject.bodyChunks[otherChunk].pos.y < base.bodyChunks[myChunk].pos.y && this.AI.attackCounter > 0)
        {
            BodyChunk bodyChunk = otherObject.bodyChunks[otherChunk];
            bodyChunk.vel.y = bodyChunk.vel.y - num / otherObject.bodyChunks[otherChunk].mass;
            BodyChunk bodyChunk2 = base.bodyChunks[myChunk];
            bodyChunk2.vel.y = bodyChunk2.vel.y + num / 2f;
            int num2 = 30;
            if (otherObject is Creature)
            {
                SocialMemory.Relationship relationship = base.abstractCreature.state.socialMemory.GetRelationship((otherObject as Creature).abstractCreature.ID);
                if (relationship != null)
                {
                    if (relationship.like > -0.5f)
                    {
                        relationship.like = Mathf.Lerp(relationship.like, 0f, 0.001f);
                    }
                    if (relationship.like >= 0f)
                    {
                        num2 = 10 + (int)(20f * Mathf.InverseLerp(1f, 0f, relationship.like));
                    }
                    else
                    {
                        num2 = 30 + (int)(220f * Mathf.InverseLerp(0f, -1f, relationship.like));
                    }
                }
            }
            if (this.AI.attackCounter > num2)
            {
                this.AI.attackCounter = num2;
            }
        }
        if (myChunk == 2 && base.grasps[0] == null && otherObject is Creature && ((otherObject as Creature).dead || otherObject.TotalMass < base.TotalMass * 0.9f) && base.Template.CreatureRelationship((otherObject as Creature).Template).type == CreatureTemplate.Relationship.Type.Eats)
        {
            this.Grab(otherObject, 0, otherChunk, Creature.Grasp.Shareability.CanNotShare, 1f, true, true);
            this.room.PlaySound((!(otherObject is Player)) ? SoundID.Jet_Fish_Grab_NPC : SoundID.Jet_Fish_Grab_Player, base.mainBodyChunk);
        }
    }