示例#1
0
        public ActorBody(Actor owner)
        {
            this.owner = owner;
            MaxHealth  = Health = owner.Talents.GetTalent("attrb_constitution").As <AttributeComponent>().Rank;

            bodyParts = new Dictionary <BodySlot, BodyPart>
            {
                { BodySlot.Torso, new BodyPart("Torso", BodySlot.Torso, Health, 0) },
                { BodySlot.Head, new BodyPart("Head", BodySlot.Head, Health, -World.STANDARD_DEVIATION * 5 / 3) },
                { BodySlot.MainArm, new BodyPart("Right Arm", BodySlot.MainArm, Health / 2, -World.STANDARD_DEVIATION * 4 / 3) },
                { BodySlot.OffArm, new BodyPart("Left Arm", BodySlot.OffArm, Health / 2, -World.STANDARD_DEVIATION * 4 / 3) },
                { BodySlot.MainHand, new BodyPart("Main Hand", BodySlot.MainHand, Health / 3, -World.STANDARD_DEVIATION * 4 / 3) },
                { BodySlot.OffHand, new BodyPart("Off Hand", BodySlot.OffHand, Health / 3, -World.STANDARD_DEVIATION * 4 / 3) },
                { BodySlot.Leg, new BodyPart("Leg", BodySlot.Leg, Health / 2, -2) },
                { BodySlot.Feet, new BodyPart("Feet", BodySlot.Feet, Health / 3, -4) }
            };


            Punch = new MeleeComponent(null, new MeleeComponentTemplate
            {
                ComponentId             = "punch",
                ActionDescription       = "punch",
                ActionDescriptionPlural = "punches",
                Skill       = "skill_unarmed",
                HitBonus    = 0,
                Damage      = Rand.Constant(-5),
                DamageType  = Combat.DamageTypes["crush"],
                Penetration = 1,
                WeaponSpeed = 100,
                Reach       = 0,
                Strength    = 0,
                Parry       = 0
            });
        }
        public override void ComponentAwake()
        {
            if (!UnityUtils.Exists(player))
            {
                Debug.LogError($"Object '{gameObject.name}' needs a reference to the player object on component 'DoNothingHumanoidBehavior'");
                throw new UnityException($"Object '{gameObject.name}' needs a reference to the player object on component 'DoNothingHumanoidBehavior'");
            }

            base.ComponentAwake();
            playerBrain   = GetRequiredComponent <PlayerBrainComponent>(player);
            meleeCollider = GetRequiredComponentInChildren <MeleeComponent>();
        }
示例#3
0
        public override void ComponentAwake()
        {
            actor          = GetRequiredComponent <ActorComponent>();
            animator       = GetRequiredComponent <HumanoidSkeletonAnimatorComponent>();
            cameraEffector = GetRequiredComponent <LevelCameraEffectorComponent>(GetRequiredObject("Level"));
            meleeCollider  = GetRequiredComponentInChildren <MeleeComponent>();

            if (isTiedUp)
            {
                animator.Tied();
            }

            base.ComponentAwake();
        }
示例#4
0
 public override void ComponentAwake()
 {
     base.ComponentAwake();
     playerBrain   = GetRequiredComponent <PlayerBrainComponent>(player);
     meleeCollider = GetRequiredComponentInChildren <MeleeComponent>();
 }