Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        private void DrawHostilesMenu()
        {
            if (reaper == null)
            {
                if (GUILayout.Button("Spawn Reaper"))
                {
                    GameObject prefabForTechType = CraftData.GetPrefabForTechType(TechType.ReaperLeviathan, true);
                    GameObject gameObject        = Utils.CreatePrefab(prefabForTechType);
                    LargeWorldEntity.Register(gameObject);
                    CrafterLogic.NotifyCraftEnd(gameObject, TechType.ReaperLeviathan);
                    gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                    reaper = gameObject.GetComponentInChildren <ReaperLeviathan>();
                    gameObject.transform.position += 50f * gameObject.transform.forward;
                }
            }
            else
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Reaper Components"))
                {
                    foreach (Component c in reaper.GetComponentsInChildren(typeof(Component)))
                    {
                        Log.Print("Component: " + c + " on go: " + c.gameObject.name);
                    }
                }

                if (GUILayout.Button("Delete Reaper"))
                {
                    Destroy(reaper.gameObject);
                }

                if (GUILayout.Button("AttackCyclops information"))
                {
                    AttackCyclops ac = reaper.GetComponent <AttackCyclops>();
                    Log.Print("LastTarget: " + ac.lastTarget);
                    Log.Print("aggressPerSecond: " + ac.aggressPerSecond);
                    Log.Print("attackAggressionThreshold: " + ac.attackAggressionThreshold);
                    Log.Print("attackPause: " + ac.attackPause);
                    Log.Print("maxDistToLeash: " + ac.maxDistToLeash);
                    Log.Print("swimVelocity: " + ac.swimVelocity);
                    Log.Print("swimInterval: " + ac.swimInterval);
                    Log.Print("aggressiveToNoise Falloff: " + ac.aggressiveToNoise.Falloff);
                    Log.Print("aggressiveToNoise Value: " + ac.aggressiveToNoise.Value);
                }

                GUILayout.Space(10);
            }

            if (crabsquid == null)
            {
                if (GUILayout.Button("Spawn Crabsquid"))
                {
                    GameObject prefabForTechType = CraftData.GetPrefabForTechType(TechType.CrabSquid, true);
                    GameObject gameObject        = Utils.CreatePrefab(prefabForTechType);
                    LargeWorldEntity.Register(gameObject);
                    CrafterLogic.NotifyCraftEnd(gameObject, TechType.CrabSquid);
                    gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                    crabsquid = gameObject.GetComponentInChildren <CrabSquid>();
                    gameObject.transform.position += 50f * gameObject.transform.forward;
                }
            }
            else
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Crabsquid Components"))
                {
                    foreach (Component c in crabsquid.GetComponentsInChildren(typeof(Component)))
                    {
                        Log.Print("Component: " + c + " on go: " + c.gameObject.name);
                    }
                }

                if (GUILayout.Button("Delete Crabsquid"))
                {
                    Destroy(crabsquid.gameObject);
                }

                GUILayout.Space(10);
            }

            if (ghostlevi == null)
            {
                if (GUILayout.Button("Spawn Ghost Levi"))
                {
                    GameObject prefabForTechType = CraftData.GetPrefabForTechType(TechType.GhostLeviathan, true);
                    GameObject gameObject        = Utils.CreatePrefab(prefabForTechType);
                    LargeWorldEntity.Register(gameObject);
                    CrafterLogic.NotifyCraftEnd(gameObject, TechType.GhostLeviathan);
                    gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                    ghostlevi = gameObject.GetComponentInChildren <GhostLeviathan>();
                    gameObject.transform.position += 50f * gameObject.transform.forward;
                }
            }
            else
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Ghost Levi Components"))
                {
                    foreach (Component c in ghostlevi.GetComponentsInChildren(typeof(Component)))
                    {
                        Log.Print("Component: " + c + " on go: " + c.gameObject.name);
                    }
                }

                if (GUILayout.Button("Delete Ghost Levi"))
                {
                    Destroy(ghostlevi.gameObject);
                }

                GUILayout.Space(10);
            }

            if (seaDragon == null)
            {
                if (GUILayout.Button("Spawn Seadragon"))
                {
                    GameObject prefabForTechType = CraftData.GetPrefabForTechType(TechType.SeaDragon, true);
                    GameObject gameObject        = Utils.CreatePrefab(prefabForTechType);
                    LargeWorldEntity.Register(gameObject);
                    CrafterLogic.NotifyCraftEnd(gameObject, TechType.SeaDragon);
                    gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                    seaDragon = gameObject.GetComponentInChildren <SeaDragon>();
                    gameObject.transform.position += 50f * gameObject.transform.forward;
                }
            }
            else
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Seadragon Components"))
                {
                    foreach (Component c in seaDragon.GetComponentsInChildren(typeof(Component)))
                    {
                        Log.Print("Component: " + c + " on go: " + c.gameObject.name);
                    }
                }

                if (GUILayout.Button("Delete Seadragon"))
                {
                    Destroy(seaDragon.gameObject);
                }

                GUILayout.Space(10);
            }

            if (warper == null)
            {
                if (GUILayout.Button("Spawn warper"))
                {
                    GameObject prefabForTechType = CraftData.GetPrefabForTechType(TechType.Warper, true);
                    GameObject gameObject        = Utils.CreatePrefab(prefabForTechType);
                    LargeWorldEntity.Register(gameObject);
                    CrafterLogic.NotifyCraftEnd(gameObject, TechType.Warper);
                    gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                    warper = gameObject.GetComponentInChildren <Warper>();
                    gameObject.transform.position += 50f * gameObject.transform.forward;
                }
            }
            else
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Warper Components"))
                {
                    foreach (Component c in warper.GetComponentsInChildren(typeof(Component)))
                    {
                        Log.Print("Component: " + c + " on go: " + c.gameObject.name);
                    }
                }

                if (GUILayout.Button("Delete Warper"))
                {
                    Destroy(warper.gameObject);
                }

                GUILayout.Space(10);
            }
        }