コード例 #1
0
        public override void AddCustomBehaviour(CreatureComponents components)
        {
            CreateTrail(prefab.SearchChild("root"), new Transform[] { prefab.SearchChild("spine1").transform, prefab.SearchChild("spine2").transform, prefab.SearchChild("spine3").transform, prefab.SearchChild("spine4").transform }, components, 0.2f);

            var fleeOnDamage = prefab.AddComponent <FleeOnDamage>();

            fleeOnDamage.breakLeash       = true;
            fleeOnDamage.swimVelocity     = 6f;
            fleeOnDamage.damageThreshold  = 40f;
            fleeOnDamage.evaluatePriority = 0.9f;

            var fleeFromPredators = prefab.AddComponent <SwimAwayFromPredators>();

            fleeFromPredators.actionLength     = 6f;
            fleeFromPredators.swimVelocity     = 15f;
            fleeFromPredators.maxReactDistance = 35f;
            fleeFromPredators.evaluatePriority = 0.9f;
            fleeFromPredators.targetType       = EcoTargetType.Leviathan;

            var idleSounds = prefab.AddComponent <CreatureRandomSound>();

            idleSounds.asset       = QPatch.CreateFMODAsset("ThalassaceanRoar");
            idleSounds.minInterval = 20f;
            idleSounds.maxInterval = 35f;
        }
コード例 #2
0
        public override void AddCustomBehaviour(CreatureComponents components)
        {
            GameObject spine2 = prefab.SearchChild("Spine2");

            CreateTrail(spine2, new Transform[] { spine2.SearchChild("Spine3").transform, spine2.SearchChild("Spine4").transform, spine2.SearchChild("Spine5").transform, spine2.SearchChild("Spine6").transform, spine2.SearchChild("Spine7").transform, spine2.SearchChild("Spine8").transform, spine2.SearchChild("Spine9").transform }, components, 3f);
            MakeAggressiveTo(30f, 2, EcoTargetType.Shark, 0f, 1.5f);
            MakeAggressiveTo(35f, 2, EcoTargetType.SubDecoy, 0f, 2f);
            MakeAggressiveTo(15f, 1, EcoTargetType.MediumFish, 0f, 1.5f);
            GameObject mouth        = prefab.SearchChild("Mouth");
            GameObject lClawTrigger = prefab.SearchChild("LClaw");
            GameObject rClawTrigger = prefab.SearchChild("RClaw");

            GulperBehaviour gulperBehaviour = prefab.AddComponent <GulperBehaviour>();

            gulperBehaviour.creature = components.creature;

            GulperMeleeAttack_Mouth meleeAttack = prefab.AddComponent <GulperMeleeAttack_Mouth>();

            meleeAttack.mouth                   = mouth;
            meleeAttack.canBeFed                = false;
            meleeAttack.biteInterval            = 1f;
            meleeAttack.biteDamage              = 100f;
            meleeAttack.eatHungerDecrement      = 0.05f;
            meleeAttack.eatHappyIncrement       = 0.1f;
            meleeAttack.biteAggressionDecrement = 0.02f;
            meleeAttack.biteAggressionThreshold = 0.1f;
            meleeAttack.lastTarget              = components.lastTarget;
            meleeAttack.creature                = components.creature;
            meleeAttack.liveMixin               = components.liveMixin;
            meleeAttack.animator                = components.creature.GetAnimator();

            var avoidObstacels = prefab.GetComponent <AvoidObstacles>();

            avoidObstacels.avoidanceIterations = 20;
            avoidObstacels.scanInterval        = 0.5f;

            mouth.AddComponent <OnTouch>();
            lClawTrigger.AddComponent <OnTouch>();
            rClawTrigger.AddComponent <OnTouch>();
            AddClawAttack("LClaw", "swipeL", components);
            AddClawAttack("RClaw", "swipeR", components);

            AttackCyclops actionAtkCyclops = prefab.AddComponent <AttackCyclops>();

            actionAtkCyclops.swimVelocity              = 62f;
            actionAtkCyclops.aggressiveToNoise         = new CreatureTrait(0f, 0.01f);
            actionAtkCyclops.evaluatePriority          = 0.6f;
            actionAtkCyclops.priorityMultiplier        = ECCHelpers.Curve_Flat();
            actionAtkCyclops.maxDistToLeash            = 90f;
            actionAtkCyclops.attackAggressionThreshold = 0.4f;

            components.locomotion.driftFactor     = 0.8f;
            components.locomotion.maxAcceleration = 18f;

            var idleSounds = prefab.AddComponent <CreatureRandomSound>();

            idleSounds.asset       = QPatch.CreateFMODAsset("GulperRoar");
            idleSounds.minInterval = 30f;
            idleSounds.maxInterval = 60f;
        }
コード例 #3
0
        public override void AddCustomBehaviour(CreatureComponents components)
        {
            var clownPincherBehaviour = prefab.AddComponent <ClownPincherBehaviour>();

            var scavengeBehaviour = prefab.AddComponent <ClownPincherScavengeBehaviour>();

            scavengeBehaviour.clownPincher            = clownPincherBehaviour;
            scavengeBehaviour.swimVelocity            = 3f;
            scavengeBehaviour.evaluatePriority        = 0.8f;
            scavengeBehaviour.priorityWhileScavenging = 0.8f;

            var fleeFromPredators = prefab.AddComponent <SwimAwayFromPredators>();

            fleeFromPredators.swimVelocity     = 4f;
            fleeFromPredators.maxReactDistance = 5f;
            fleeFromPredators.actionLength     = 3f;
            fleeFromPredators.evaluatePriority = 0.89f;

            var nibble = prefab.SearchChild("Mouth").AddComponent <ClownPincherNibble>();

            nibble.creature     = components.creature;
            nibble.clownPincher = clownPincherBehaviour;
            nibble.liveMixin    = components.liveMixin;

            var idleSounds = prefab.AddComponent <CreatureRandomSound>();

            idleSounds.asset       = QPatch.CreateFMODAsset("ClownPincherIdle");
            idleSounds.minInterval = 30f;
            idleSounds.maxInterval = 120f;

            prefab.AddComponent <SleepAtNight>().evaluatePriority = 0.9f;

            GameObject worldModel = prefab.SearchChild("WorldModel");

            CreateTrail(worldModel.SearchChild("Spine3", ECCStringComparison.StartsWith), new Transform[] { worldModel.SearchChild("Spine4", ECCStringComparison.StartsWith).transform }, components, 1f);

            components.creature.Hunger = new CreatureTrait(0f, -0.01f);
        }
コード例 #4
0
        public override void AddCustomBehaviour(CreatureComponents components)
        {
            GameObject          mouth       = prefab.SearchChild("Head");
            TwisteelMeleeAttack meleeAttack = prefab.AddComponent <TwisteelMeleeAttack>();

            meleeAttack.mouth                   = mouth;
            meleeAttack.biteInterval            = 3f;
            meleeAttack.biteDamage              = 25f;
            meleeAttack.eatHungerDecrement      = 0.8f;
            meleeAttack.eatHappyIncrement       = 0.1f;
            meleeAttack.biteAggressionDecrement = 0.02f;
            meleeAttack.biteAggressionThreshold = 0.1f;
            meleeAttack.lastTarget              = components.lastTarget;
            meleeAttack.creature                = components.creature;
            meleeAttack.liveMixin               = components.liveMixin;
            meleeAttack.animator                = components.creature.GetAnimator();

            var fleeOnDamage = prefab.AddComponent <FleeOnDamage>();

            fleeOnDamage.breakLeash       = true;
            fleeOnDamage.swimVelocity     = 12f;
            fleeOnDamage.damageThreshold  = 30f;
            fleeOnDamage.evaluatePriority = 0.9f;

            GameObject trailParent = prefab.SearchChild("Spine1");

            Transform[] trails = new Transform[] { prefab.SearchChild("Spine2").transform, prefab.SearchChild("Spine3").transform, prefab.SearchChild("Spine4").transform, prefab.SearchChild("Spine5").transform, prefab.SearchChild("Spine6").transform, prefab.SearchChild("Spine7").transform, prefab.SearchChild("Spine8").transform, prefab.SearchChild("Spine9").transform, prefab.SearchChild("Spine10").transform, prefab.SearchChild("Spine11").transform, prefab.SearchChild("Spine12").transform, prefab.SearchChild("Spine13").transform, prefab.SearchChild("Spine14").transform, prefab.SearchChild("Spine15").transform, prefab.SearchChild("Spine16").transform, prefab.SearchChild("Spine17").transform, prefab.SearchChild("Spine18").transform };
            CreateTrail(trailParent, trails, components, 4f, 0.5f);
            MakeAggressiveTo(27f, 2, EcoTargetType.Shark, 0.5f, 0.67f);
            MakeAggressiveTo(15f, 1, EcoTargetType.MediumFish, 0f, 0.4f);
            MakeAggressiveTo(7f, 1, EcoTargetType.SmallFish, 0.1f, 0.2f);

            var idleSounds = prefab.AddComponent <CreatureRandomSound>();

            idleSounds.asset       = QPatch.CreateFMODAsset("TwisteelIdle");
            idleSounds.minInterval = 10f;
            idleSounds.maxInterval = 30f;
        }