Beispiel #1
0
        private static void PreCleanup()
        {
            GameObject enemySample = GameObject.Instantiate(UnityEngine.Object.Instantiate <GameObject>(UnityEngine.Object.FindObjectOfType <SpawnDoorScript>().enemy));

            enemySample.layer = 13;
            enemySample.name  = "New Enemy";
            enemySample.transform.position = MFPClassicAssets.player.transform.position;
            enemySample.SetActive(true);

            EnemyScript enemySc = enemySample.GetComponent <EnemyScript>();

            enemySc.alwaysOnFlatGround = false;
            enemySc.dontWallCheckLeft  = false;
            enemySc.dontWallCheckRight = false;

            MFPClassicAssets.enemySample = GameObject.Find("New Enemy");

            MFPClassicAssets.medkit = enemySample.GetComponent <EnemyScript>().medkit;

            MFPClassicAssets.WeaponPickerSample = enemySample.transform.Find("EnemyGraphics/Armature/Center/LowerBack/UpperBack/Shoulder_R/UpperArm_R/LowerArm_R/Hand_R/pistol").gameObject;

            MFPClassicAssets.enemySample.SetActive(false);

            MFPClassicAssets.doorSpawnerSample = GameObject.FindObjectOfType <SpawnDoorScript>().gameObject;

            MFPClassicAssets.doorSpawnerSample = GameObject.Instantiate(GameObject.FindObjectOfType <SpawnDoorScript>().transform.parent.gameObject);
            MFPClassicAssets.doorSpawnerSample.GetComponentInChildren <BoxCollider>().center = new Vector3(0, 0, 25f);
            MFPClassicAssets.doorSpawnerSample.GetComponentInChildren <BoxCollider>().size   = new Vector3(2, 10.5f, 10);
            MFPClassicAssets.doorSpawnerSample.SetActive(false);

            MFPClassicAssets.openableDoor = MFPClassicAssets.classicBundle.LoadAsset("OpenableDoor") as GameObject;

            MFPEditorUtils.Log("Map cleanup warmup done");
        }
        public virtual void Start()
        {
            MFPEditorUtils.Log("PlayerWings Awake");

            root         = (RootScript)GameObject.Find("Root").GetComponent(typeof(RootScript));
            playerScript = (PlayerScript)GameObject.Find("Player").GetComponent(typeof(PlayerScript));
            playerInput  = ReInput.players.GetPlayer(0);


            gameObject.AddComponent <BoxCollider>();

            // theSound = (AudioSource)GetComponent(typeof(AudioSource));
            transform.parent        = GameObject.Find("Player/PlayerGraphics/Armature/Center/LowerBack/UpperBack/Neck/Head").transform;
            transform.localPosition = new Vector3(-0.226f, 0.0f, 0.007f);
            //   GameObject.Find("Player/PlayerGraphics/Hair").SetActive(false);
            //     propeller = transform.Find("FlyHelmet_Propeller");
            //     umbrella = propeller.Find("FlyHelmet_Umbrella");
            //   propellerStartRotation = propeller.localRotation;
            playerScript.propellerHat = true;
            upperLegR = GameObject.Find("Player/PlayerGraphics/Armature/Center/Hip_R/UpperLeg_R").transform;
            lowerLegR = GameObject.Find("Player/PlayerGraphics/Armature/Center/Hip_R/UpperLeg_R/LowerLeg_R").transform;
            upperLegL = GameObject.Find("Player/PlayerGraphics/Armature/Center/Hip_L/UpperLeg_L").transform;
            lowerLegL = GameObject.Find("Player/PlayerGraphics/Armature/Center/Hip_L/UpperLeg_L/LowerLeg_L").transform;

            if (checkpointFix)
            {
                playerScript.transform.position = FinalBattleController.playerPosHack;
            }
        }
Beispiel #3
0
        public bool tutorialEnemyAlive = false; //stab ve kicklerken tek kareliğine true yap


        public void CheckTutorialStatus()
        {
            if (tutorialEnemyAlive && MFPClassicAssets.root.allEnemies.Length != 0)
            {
                if (!MFPClassicAssets.root.allEnemies[0].GetComponent <EnemyScript>().enabled)
                {
                    switch (recentAttackType)
                    {
                    default:
                        break;

                    case "kick":
                        MFPEditorUtils.Log("Tutorial enemy got kicked to death.");
                        postKillSpeech.locStringId = "pedro04c_level1_MFPClassic";
                        break;

                    case "stab":
                        MFPEditorUtils.Log("Tutorial enemy got stabbed to death.");
                        postKillSpeech.locStringId = "pedro04b_level1_MFPClassic";
                        break;
                    }

                    MFPClassicAssets.root.clearInstructionText();
                }

                if (recentAttackType != "")
                {
                    recentAttackType = "";
                }
            }
        }
Beispiel #4
0
        public void Update()
        {
            if (spawnDoors != null)
            {
                if (!enemiesKilled)
                {
                    int validation = 0;

                    foreach (SpawnDoorScript door in spawnDoors)
                    {
                        if (door.nrOfEnemies <= 0)
                        {
                            validation++;
                        }
                    }

                    if (validation == spawnDoors.Length)
                    {
                        enemiesKilled = true;
                        MFPEditorUtils.Log("Elevator coming down...");

                        switchScript.output = 1;
                    }
                }
            }
        }
        public static void LoadGunSounds(AudioClip[] original)
        {
            MFPEditorUtils.Log("Start gun sound load");

            if (weaponSound != null)
            {
                return;
            }

            AudioClip pistol1_alt_mixdown = classicBundle.LoadAsset("Pistol_alt1_mixdown") as AudioClip;

            // AudioClip Submachine_gun_mixdown = classicBundle.LoadAsset("Submachine gun_mixdown") as AudioClip;

            MFPEditorUtils.Log("Pistol and uzi mixdown loaded");

            Array.Copy(original, weaponSound = new AudioClip[original.Length], original.Length);

            MFPEditorUtils.Log("Array copied");

            weaponSound[0] = pistol1_alt_mixdown;
            weaponSound[1] = pistol1_alt_mixdown;
            weaponSound[2] = pistol1_alt_mixdown;

            //  weaponSound[3] = Submachine_gun_mixdown;
            //  weaponSound[4] = Submachine_gun_mixdown;


            MFPEditorUtils.Log("Sounds set");
        }
Beispiel #6
0
        public void Step()
        {
            MFPEditorUtils.Log("Step");

            GameObject.FindObjectOfType <CameraScript>().bigScreenShake = 0.5f;
            vic.audioSource.PlayOneShot(footStep);
            //MFPClassicAssets.root.rumble(1, 1000, 1f);
        }
        public static void Log(object obj)
        {
            if (obj is AutoControlZoneScript)
            {
                AutoControlZoneScript aczs = obj as AutoControlZoneScript;

                if (aczs.inputSwitch != null)
                {
                    foreach (SwitchScript switchScript in aczs.inputSwitch)
                    {
                        MFPEditorUtils.Log("inputSwitch " + switchScript.transform.name);
                    }
                }

                if (aczs.forceOffSwitch != null)
                {
                    MFPEditorUtils.Log("forceOffSwitch " + aczs.forceOffSwitch.transform.name);
                }

                MFPEditorUtils.Log("forceInterruptPlayerOverride " + aczs.forceInteruptPlayerOverride.ToString());

                MFPEditorUtils.Log("enableOverrideOnEnter " + aczs.enableOverrideOnEnter.ToString());
                MFPEditorUtils.Log("disableOverrideWhenLeavingZone " + aczs.disableOverrideWhenLeavingZone.ToString());
                MFPEditorUtils.Log("disableOverrideAfterInteract " + aczs.disableOverrideAfterInteract.ToString());
                MFPEditorUtils.Log("disableOverrideAfterTime " + aczs.disableOverrideAfterTime.ToString());
                MFPEditorUtils.Log("disableOverrideTimer " + aczs.disableOverrideTimer.ToString());

                MFPEditorUtils.Log("");

                MFPEditorUtils.Log("reTrigger " + aczs.reTrigger.ToString());
                MFPEditorUtils.Log("triggerDelay " + aczs.triggerDelay.ToString());
                MFPEditorUtils.Log("triggerOnlyOnEnter " + aczs.triggerOnlyOnEnter.ToString());

                MFPEditorUtils.Log("");

                MFPEditorUtils.Log("setXMoveAmount " + aczs.setXMoveAmount.ToString());
                MFPEditorUtils.Log("xMoveAmount " + aczs.xMoveAmount.ToString());
                MFPEditorUtils.Log("crouch " + aczs.crouch.ToString());
                MFPEditorUtils.Log("jump " + aczs.jump.ToString());
                MFPEditorUtils.Log("dodge " + aczs.dodge.ToString());
                MFPEditorUtils.Log("interact " + aczs.interact.ToString());
                MFPEditorUtils.Log("slowMotion " + aczs.slowMotion.ToString());
                MFPEditorUtils.Log("disableSlowMotionOnExit " + aczs.disableSlowMotionOnExit.ToString());
                MFPEditorUtils.Log("reload " + aczs.reload.ToString());
                MFPEditorUtils.Log("fire " + aczs.fire.ToString());
                MFPEditorUtils.Log("secondaryFire " + aczs.secondaryFire.ToString());

                MFPEditorUtils.Log("");

                MFPEditorUtils.Log("setAim " + aczs.setAim.ToString());
                MFPEditorUtils.Log("aimPos " + aczs.aimPos.ToString());
                MFPEditorUtils.Log("secondaryAimPos " + aczs.secondaryAimPos.ToString());

                MFPEditorUtils.Log("");

                MFPEditorUtils.Log("weapon " + aczs.weapon.ToString());
            }
        }
Beispiel #8
0
 public void Update()
 {
     if (tracking == null)
     {
         target.StartCoroutine("triggerSpeech");
         MFPEditorUtils.Log("Triggered");
         Destroy(this);
     }
 }
        public void OnCollisionEnter(Collision coll)
        {
            MFPEditorUtils.Log("hit registered " + coll.transform.name);

            if (coll.transform.tag == "Bullet")
            {
                victor.Hurt(coll.gameObject.GetComponent <BulletScript>());
            }
        }
        public static EnemyChairScript CreateChairEnemy(GameObject chair, EnemyScript enemy, bool faceRight, bool fallOver = true)
        {
            EnemyChairScript chairScript = chair.AddComponent <EnemyChairScript>();

            chairScript.targetEnemy = enemy;

            enemy.standStill         = true;
            enemy.faceRight          = faceRight;
            enemy.transform.position = chairScript.gameObject.transform.position + new Vector3(-1, 0, 0);

            chairScript.fallOver = fallOver;

            MFPEditorUtils.Log("Created chair enemy from: " + enemy.transform.name);

            return(chairScript);
        }
        public static SpeechTriggerControllerScript GenerateSpeechScript(GameObject target, Transform followTarget, string speakerName, string locStringID, AudioClip voice = null, bool freezePlayer = false, GameObject forceSpawnPedro = null)
        {
            SwitchScript switchScript = target.AddComponent <SwitchScript>();

            switchScript.output = 1;

            SpeechTriggerScript speechTriggerScript = target.AddComponent <SpeechTriggerScript>();

            if (freezePlayer)
            {
                speechTriggerScript.clickToContinue           = true;
                speechTriggerScript.clickToContinueDontFreeze = false;
            }


            speechTriggerScript.followTransform = followTarget;

            speechTriggerScript.speakerName = speakerName;

            if (forceSpawnPedro != null)
            {
                speechTriggerScript.forceSpawnPedro = forceSpawnPedro.GetComponent <PedroScript>();
            }

            string testString = "";

            LocalizationManager.TryGetTranslation(speakerName, out testString);

            if (testString.ToLower().Contains("missing translation"))
            {
                MFPEditorUtils.CreateTranslation(speakerName, speakerName);
            }


            if (voice != null)
            {
                speechTriggerScript.voice = voice;
            }

            speechTriggerScript.locStringId = locStringID;

            SpeechTriggerControllerScript controllerScript = target.AddComponent <SpeechTriggerControllerScript>();;

            controllerScript.inputSwitch = new SwitchScript[0];

            return(controllerScript);
        }
Beispiel #12
0
        public void OnTriggerEnter(Collider coll)
        {
            MFPEditorUtils.Log(doOnce.ToString());
            if (doOnce)
            {
                if (coll.transform.name == "Player")
                {
                    for (int i = 0; i < spawnDoors.Length; i++)
                    {
                        spawnDoors[i].isTriggered = true;
                    }

                    doOnce = false;
                    MFPEditorUtils.Log("Triggered...");
                }
            }
        }
        IEnumerator WaitDeathTip(Victor.VictorAttacks deathAttack)
        {
            yield return(new WaitForSecondsRealtime(2.8f));

            switch (deathAttack)
            {
            case Victor.VictorAttacks.BulletMouth:
                MFPEditorUtils.doPedroHint("Try dodging when the bullets start coming.");
                break;

            case Victor.VictorAttacks.LittleHeads:
                MFPEditorUtils.doPedroHint("Try reloading or using a faster weapon.");
                break;

            case Victor.VictorAttacks.Spatula:
                MFPEditorUtils.doPedroHint("Perhaps stepping back before the spatula hits\n will work.");
                break;
            }
        }
Beispiel #14
0
        void Awake()
        {
            if (MFPClassicAssets.rootShared.levelLoadedFromLevelSelectScreen)
            {
                MFPClassicAssets.player.health = 1f;
            }


            inst = this;

            playerInput = ReInput.players.GetPlayer(0);

            MFPClassicAssets.root.nrOfEnemiesTotal        = 0;
            MFPClassicAssets.root.dontAllowCheckpointSave = true;

            MFPEditorUtils.Log("MapManager awake, will load level ID: " + currentLevel.ToString());
            //     GameObject.Find("Main Camera").GetComponent<UnityEngine.PostProcessing.PostProcessingBehaviour>().enabled = false;

            postProcess = GameObject.Find("Main Camera").GetComponent <PostProcessingBehaviour>();
            PreparePostProcess();

            // SceneManager.LoadScene(MFPClassicAssets.classicLevelsBundle.GetAllScenePaths()[0], LoadSceneMode.Additive);

            //cutscene for bossfight not done yet
            if (currentLevel == 7)
            {
                currentLevel = 8;
            }

            GameObject map = GameObject.Instantiate(MFPClassicAssets.classicBundle.LoadAsset("MFPLevel" + currentLevel.ToString()) as GameObject);

            map.name = "MFPLevel";

            if (currentLevel != 8)
            {
                map.transform.position = new Vector3(9999, 9999, map.transform.position.z);
            }

#if !DEBUG
            Instantiate(MFPClassicAssets.classicBundle.LoadAsset("alphaUI") as GameObject);
#endif

            RenderSettings.ambientIntensity    = 0;
            RenderSettings.ambientEquatorColor = Color.black;
            RenderSettings.ambientGroundColor  = Color.black;
            RenderSettings.ambientLight        = Color.black;
            RenderSettings.ambientSkyColor     = Color.black;
            RenderSettings.ambientMode         = UnityEngine.Rendering.AmbientMode.Flat;

            RenderSettings.skybox.color = Color.black;

            RenderSettings.skybox = null;



            MFPClassicAssets.player.transform.position = new Vector3(9999, 9999, 0);
            MFPClassicAssets.player.ySpeed             = (float)1;

            MFPClassicAssets.player.transform.position = GameObject.Find("MFPLevel/player_spawn").transform.position;

            MFPEditorUtils.Log(map.name);

            StartCoroutine(WaitLevelLoad());
        }
Beispiel #15
0
        public static void Clean()
        {
            PreCleanup();


            string[] objectblacklist = new string[]
            {
                "glass_window_frame_large",
                "Dust Particles",
                "RagdollColl",
                "CornerBeam",
                "WallBuilder",
                "FloorBuilder",
                "Table",
                "fence",
                "Pipe",
                "Crate,",
                "Chair",
                "TV",
                "Corner",
                "Steel_",
                "Metal_",
                "Quad",
                "Quad(1)"
            };



            foreach (GameObject gameObject in UnityEngine.Object.FindObjectsOfType(typeof(GameObject)) as GameObject[])
            {
                if (gameObject.name.Contains("Enemy") && !gameObject.name.Contains("Graphics") && !gameObject.name.Contains("New"))
                {
                    gameObject.SetActive(false);
                }

                if (gameObject.layer == 14 || gameObject.layer == 15 || gameObject.layer == 16 || gameObject.layer == 19 || gameObject.layer == 8 || gameObject.layer == 1 || gameObject.layer == 18)
                {
                    if (gameObject.layer != 16)
                    {
                        UnityEngine.Object.Destroy(gameObject);
                    }
                    else
                    {
                        UnityEngine.Object.Destroy(gameObject.transform.root.gameObject);
                    }
                }

                #region Specific Name Checks If Chain Hell
                if (gameObject.name.Contains("glass_window_frame_large"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("Dust Particles"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("RagdollColl"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("CornerBeam"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("Quad"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("FloorBuilder"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("WallBuilder"))
                {
                    GameObject.Destroy(gameObject);
                }

                if (gameObject.name.Contains("TV"))
                {
                    GameObject.Destroy(gameObject);
                }
                #endregion
            }

            MFPEditorUtils.Log("Map cleanup done");

            /*
             #if DEBUG
             * if (!File.Exists(MFPEditorUtils.LoadFile("mapcleaner_log.txt")))
             *  File.Create(MFPEditorUtils.LoadFile("mapcleaner_log.txt"));
             *
             * GameObject[] remainingObjects = GameObject.FindObjectsOfType<GameObject>();
             *
             * List<string> remainingObjectsStr = new List<string>();
             *
             * foreach (GameObject obj in remainingObjects)
             *  if (obj.transform.parent == null)
             *      remainingObjectsStr.Add(obj.name);
             *
             * File.WriteAllLines(MFPEditorUtils.LoadFile("mapcleaner_log.txt"), remainingObjectsStr.ToArray());
             *
             *
             #endif
             */
        }
Beispiel #16
0
        IEnumerator WaitLevelLoad()
        {
            yield return(new WaitForSeconds(0.1f));

            MFPEditorUtils.Log("Level loaded");

            GameObject.Find("Main Camera").GetComponent <CameraScript>().centerCamPosOnPlayer();

            if (!GameObject.Find("MFPLevel"))
            {
                Application.Quit();
            }

            if (GameObject.Find("MFPLevel/ZPushers") != null)
            {
                MFPEditorUtils.Log("Starting pusher preparation");

                foreach (Transform obj in GameObject.Find("MFPLevel/ZPushers").GetComponentsInChildren <Transform>())
                {
                    if (obj.transform.name != "ZPushers")
                    {
                        obj.gameObject.AddComponent <CustomZPusher>().pushIntensity = float.Parse(obj.transform.name.Replace("Player Z-Pusher=", ""), System.Globalization.CultureInfo.InvariantCulture);
                    }
                }
            }

            if (GameObject.Find("MFPLevel/OpenableDoors") != null)
            {
                foreach (Transform obj in GameObject.Find("MFPLevel/OpenableDoors").GetComponentsInChildren <Transform>())
                {
                    if (obj.transform.name != "OpenableDoors")
                    {
                        string[] args = obj.name.Split('_');
                        RuntimeEntities.CreateOpenableDoor(obj.position, args[1].ToLower().Equals("true"), float.Parse(args[2]));
                    }

                    //-- obj.gameObject.AddComponent<CustomZPusher>().pushIntensity = float.Parse(obj.transform.name.Replace("Player Z-Pusher=", ""), System.Globalization.CultureInfo.InvariantCulture);
                }
            }

            if (GameObject.Find("MFPLevel/DoorSpawns") != null)
            {
                foreach (Transform obj in GameObject.Find("MFPLevel/DoorSpawns").GetComponentsInChildren <Transform>())
                {
                    if (obj.transform.name.Contains("visualdoor"))
                    {
                        RuntimeEntities.CreateEnemyDoor(obj.transform.position, 0, true);
                    }
                }
            }

            if (GameObject.Find("MFPLevel/BreakableGlass") != null)
            {
                foreach (Transform glass in GameObject.Find("MFPLevel/BreakableGlass").GetComponentsInChildren <Transform>())
                {
                    if (glass.name != "BreakableGlass")
                    {
                        if (glass.name.Contains("glass_piece"))
                        {
                            glass.gameObject.AddComponent <GlassPieceScript>();
                            glass.gameObject.AddComponent <RigidBodySlowMotion>();
                        }

                        if (glass.name == "glass_window_large")
                        {
                            glass.gameObject.AddComponent <GlassWindowScript>().glassSounds = new AudioClip[] { MFPClassicAssets.weaponSound[0], MFPClassicAssets.weaponSound[0] };

                            if (glass.transform.parent.name.Contains("easybreak"))
                            {
                                glass.gameObject.GetComponent <GlassWindowScript>().easyBreak = true;
                            }
                        }
                    }
                }
            }


            if (GameObject.Find("MFPLevel/Medkits") != null)
            {
                foreach (Transform obj in GameObject.Find("MFPLevel/Medkits").GetComponentsInChildren <Transform>())
                {
                    if (obj.name == "Medkits") //wtf???
                    {
                        continue;
                    }

                    RuntimeEntities.SpawnMedkit(obj.position);
                }
            }


            foreach (Transform obj in GameObject.Find("MFPLevel/Enemies").GetComponentsInChildren <Transform>())
            {
                if (obj.name == "Enemies") //wtf???
                {
                    continue;
                }

                GameObject newEnemy = GameObject.Instantiate(MFPClassicAssets.enemySample);
                newEnemy.transform.position = obj.transform.position;
                newEnemy.SetActive(true);

                MFPEditorUtils.Log("Enemy spawned from spawnpoint:" + obj.name);

                enemies.Add(newEnemy.GetComponent <EnemyScript>());

                if (obj.name.Split(' ').Length > 1)
                {
                    newEnemy.GetComponent <EnemyScript>().weapon = int.Parse(obj.name.Split(' ')[1]);
                }


                newEnemy.name = obj.name;
            }

            MFPEditorUtils.Log("Enemies spawned");

            PrepareLevelEntities();

            yield return(null);
        }
        public void OnGUI()
        {
            if (logs == null)
            {
                logs = new List <string>();
            }


            if (logs.Count > 10)
            {
                logs.RemoveAt(0);
            }

            foreach (string log in logs)
            {
                if (log != null)
                {
                    GUILayout.Label(log);
                }
            }

            if (Camera.main != null)
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);


                if (Physics.Raycast(ray, out hit))
                {
                    if (hit.transform != null)
                    {
                        GUILayout.Button(hit.transform.name);
                        if (Input.GetKeyDown(KeyCode.U))
                        {
                            SwitchABMoveScript carScript = GameObject.Find("Car_3 (5)").GetComponent <SwitchABMoveScript>();

                            if (carScript.inputSwitch.Length != 0)
                            {
                                MFPEditorUtils.Log(carScript.inputSwitch[0].gameObject.name);
                            }

                            MFPEditorUtils.Log(carScript.invert.ToString());
                            MFPEditorUtils.Log(carScript.moveOffset.ToString());
                            MFPEditorUtils.Log(carScript.movePos.ToString());
                            MFPEditorUtils.Log(carScript.moveSpeed.ToString());
                            MFPEditorUtils.Log(carScript.noInputSwitchAnimPause.ToString());
                            MFPEditorUtils.Log(carScript.onOffSwitchBehaviour.ToString());
                            MFPEditorUtils.Log(carScript.outputOnMovement.ToString());
                            MFPEditorUtils.Log(carScript.outputOnReachedEnd.ToString());
                            MFPEditorUtils.Log(carScript.returnAnimLengthInFrames.ToString());
                            MFPEditorUtils.Log(carScript.scaleSpeedDependingOnPlayerSpeedGameModifier.ToString());
                            MFPEditorUtils.Log(carScript.useLocalPos.ToString());


                            MFPEditorUtils.Log("------------");

                            foreach (Component comp in hit.transform.gameObject.GetComponents <Component>())
                            {
                                MFPEditorUtils.Log(comp.ToString() + " " + comp.gameObject.name);
                                ExtensiveLogging.Log(comp);
                                MFPEditorUtils.Log("------------");
                            }

                            foreach (Component comp in hit.transform.gameObject.GetComponentsInChildren <Component>())
                            {
                                MFPEditorUtils.Log(comp.ToString() + " " + comp.gameObject.name);
                                ExtensiveLogging.Log(comp);
                                MFPEditorUtils.Log("------------");
                            }
                        }
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.Y))
            {
                MFPClassicAssets.player.transform.position = new Vector3(MFPClassicAssets.player.mousePos.x, MFPClassicAssets.player.mousePos.y, 0.0f);
                MFPClassicAssets.player.ySpeed             = 1f;
            }
        }
Beispiel #18
0
        public void Update()
        {
            if (Input.GetKeyDown(KeyCode.V))
            {
                StartCoroutine(DoAttack(VictorAttacks.BulletMouth));
            }

            if (Input.GetKeyDown(KeyCode.N))
            {
                StartCoroutine(DoAttack(VictorAttacks.LittleHeads));
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                StartCoroutine(DoAttack(VictorAttacks.Spatula));
            }

            if (debugAuto)
            {
                if (!attacking && !bursting && FinalBattleController.inst.battleStarted)
                {
                    switch (currentAttack) //attack order
                    {
                    case VictorAttacks.None:
                        StartCoroutine(DoAttack(VictorAttacks.BulletMouth));
                        break;

                    case VictorAttacks.BulletMouth:
                        StartCoroutine(DoAttack(VictorAttacks.Spatula));
                        break;

                    case VictorAttacks.Spatula:
                        StartCoroutine(DoAttack(VictorAttacks.LittleHeads));
                        break;

                    case VictorAttacks.LittleHeads:
                        StartCoroutine(DoAttack(VictorAttacks.BulletMouth));
                        break;
                    }

                    MFPEditorUtils.Log("requesting new attack");
                }
            }


            if (lookAt)
            {
                Vector3 dir = (player.transform.position + new Vector3(60, 10, -25f)) - transform.position;

                float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
                headPivot.transform.rotation = Quaternion.AngleAxis(angle, -Vector3.forward);

                shootNode.transform.LookAt(player.transform);


                debugPos = dir;
            }
            else
            {
                headPivot.transform.rotation = Quaternion.Lerp(headPivot.transform.rotation, defaultHeadRotation, 0.2f);
            }
        }
Beispiel #19
0
        void PrepareLevelEntities()
        {
            if (GameObject.Find("MFPLevel/ActionMusicTrigger"))
            {
                GameObject.Find("MFPLevel/ActionMusicTrigger").AddComponent <CustomMusic>();
            }
            else
            {
                new GameObject().AddComponent <CustomMusic>();
            }

            LevelChangerScript lScript = GameObject.Find("MFPLevel/level_end").AddComponent <LevelChangerScript>();

            MFPEditorUtils.FixPlayerLoadout();

            switch (currentLevel)
            {
            case 1:

                MFPClassicAssets.player.health = 1f;

                PlayerScript playerScript = MFPClassicAssets.player;

                lScript.dontShowEndScreen = true;

                SpawnDoorScript door1 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/Door1").transform.position, 1);
                door1.GetComponent <BoxCollider>().enabled = false;


                for (int i = 1; i <= 4; i++)
                {
                    GameObject.Find("MFPLevel/SpeechTriggers/InstructionStopper" + i.ToString()).AddComponent <ClearInstructionsOnTrigger>();
                }

                GameObject.Find("Car_1").AddComponent <SwitchScript>();
                SwitchABMoveScript backgroundCar1_lv1 = GameObject.Find("Car_1").AddComponent <SwitchABMoveScript>();
                backgroundCar1_lv1.inputSwitch = new SwitchScript[] { };

                backgroundCar1_lv1.noInputSwitchAnimPause   = 166;
                backgroundCar1_lv1.animLengthInFrames       = 180;
                backgroundCar1_lv1.returnAnimLengthInFrames = 0.1f;
                backgroundCar1_lv1.movePos      = new Vector3(60, 0, 0);
                backgroundCar1_lv1.acceleration = 0.1f;

                GameObject.Find("Car_2").AddComponent <SwitchScript>();
                SwitchABMoveScript backgroundCar1_lv2 = GameObject.Find("Car_2").AddComponent <SwitchABMoveScript>();
                backgroundCar1_lv2.inputSwitch = new SwitchScript[] { };

                backgroundCar1_lv2.noInputSwitchAnimPause   = 100;
                backgroundCar1_lv2.animLengthInFrames       = 180;
                backgroundCar1_lv2.returnAnimLengthInFrames = 0.1f;
                backgroundCar1_lv2.movePos      = new Vector3(-60, 0, 0);
                backgroundCar1_lv2.acceleration = 0.1f;


                InstructionTextScript instructions1 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "in1", "in2" }, false, false, true);
                InstructionTextScript instructions2 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "instructionsJump" }, false, false, true);
                InstructionTextScript instructions3 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "instructionsShootPistol", "instructionsWeaponWheel", "instructionsKick" }, false, false, true);
                InstructionTextScript instructions4 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "instructionsWallJump1", "instructionsWallJump2" }, false, false, true);
                InstructionTextScript instructions5 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "instructionsRoll1", "instructionsRoll2" }, false, false, true);
                InstructionTextScript instructions6 = RuntimeEntities.CreateInstructionText(new GameObject(), new string[] { "instructionsFocus", "instructionsFlip1", "instructionsFlip2" }, false, false, true);

                GameObject speech_Level1Trigger1 = GameObject.Find("MFPLevel/SpeechTriggers/trigger1");
                GameObject speech_Level1Trigger2 = GameObject.Find("MFPLevel/SpeechTriggers/trigger2");
                GameObject speech_Level1Trigger3 = GameObject.Find("MFPLevel/SpeechTriggers/trigger3");
                GameObject speech_Level1Trigger4 = GameObject.Find("MFPLevel/SpeechTriggers/trigger4");
                GameObject speech_Level1Trigger5 = GameObject.Find("MFPLevel/SpeechTriggers/trigger5");
                GameObject speech_Level1Trigger6 = GameObject.Find("MFPLevel/SpeechTriggers/trigger6");

                GameObject instruction2CompletedSpeech = GameObject.Find("MFPLevel/SpeechTriggers/trigger1_1");

                GameObject tutorialThugAliveSpeech = GameObject.Find("MFPLevel/SpeechTriggers/thugIsAliveTrigger");

                GameObject speech_Level1Pedro  = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro").transform.position);
                GameObject speech_Level1Pedro2 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro2").transform.position);
                GameObject speech_Level1Pedro3 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro3").transform.position);
                GameObject speech_Level1Pedro4 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro4").transform.position);
                // GameObject speech_Level1Pedro4_5 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro4_5").transform.position);
                GameObject speech_Level1Pedro5 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro5").transform.position);
                GameObject speech_Level1Pedro6 = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro6").transform.position);

                GameObject instruction2CompletedPedro = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro_a").transform.position);

                SpeechTriggerControllerScript speechScript1_lv1 = RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger1, speech_Level1Pedro.transform, "Pedro", "pedro01_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro);
                speech_Level1Trigger1.GetComponent <SpeechTriggerControllerScript>().triggerWithoutPlayer = true;

                speechScript1_lv1.triggerInstructionTextOnFinish = instructions1;


                SpeechTriggerControllerScript speechScript1_1_level1 = RuntimeEntities.GenerateSpeechScript(new GameObject(), speech_Level1Pedro.transform, "Pedro", "pedro01a_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], false, speech_Level1Pedro);
                SpeechTriggerControllerScript speechScript1_2_level1 = RuntimeEntities.GenerateSpeechScript(instruction2CompletedSpeech, instruction2CompletedPedro.transform, "Pedro", "pedro01b_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], false, instruction2CompletedPedro);
                speechScript1_2_level1.clearInstructionTextOnStart = true;

                ActivateSpeechOnInput tutorialTalker1 = new GameObject().AddComponent <ActivateSpeechOnInput>();
                tutorialTalker1.tracking = speechScript1_lv1;
                tutorialTalker1.target   = speechScript1_1_level1;

                SpeechTriggerControllerScript speechScript2_lv1 = RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger2, speech_Level1Pedro2.transform, "Pedro", "pedro02_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro2);
                speechScript2_lv1.clearInstructionTextOnStart    = true;
                speechScript2_lv1.triggerInstructionTextOnFinish = instructions2;

                GameObject.Find("MFPLevel/SpeechTriggers/SpeechStopper1").AddComponent <SpeechStopperScript>();

                SpeechTriggerControllerScript speechScript3_lv1 = RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger3, speech_Level1Pedro3.transform, "Pedro", "pedro03_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro3);

                speechScript3_lv1.triggerInstructionTextOnFinish = instructions3;

                door1.inputSwitch = new SwitchScript[] { speechScript3_lv1.GetComponent <SwitchScript>() };
                door1.standStill  = true;

                postKillSpeech = RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger4, speech_Level1Pedro4.transform, "Pedro", "pedro04a_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro4).GetComponent <SpeechTriggerScript>();
                postKillSpeech.GetComponent <SpeechTriggerControllerScript>().triggerInstructionTextOnFinish = instructions4;
                GameObject.Find("MFPLevel/SpeechTriggers/thugIsAliveTrigger").AddComponent <TutorialThugAliveOutcome>();

                SpeechTriggerControllerScript dontKillThugSpeech = RuntimeEntities.GenerateSpeechScript(tutorialThugAliveSpeech, speech_Level1Pedro4.transform, "Pedro", "pedro04d_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], false, speech_Level1Pedro4);
                dontKillThugSpeech.GetComponent <SpeechTriggerScript>().clickToContinueDontFreeze = false;

                RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger5, speech_Level1Pedro5.transform, "Pedro", "pedro05_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro5).triggerInstructionTextOnFinish = instructions5;
                RuntimeEntities.GenerateSpeechScript(speech_Level1Trigger6, speech_Level1Pedro6.transform, "Pedro", "pedro06_level1_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level1Pedro6).triggerInstructionTextOnFinish = instructions6;
                break;

            case 2:

                GameObject.FindObjectOfType <LevelChangerScript>().dontShowEndScreen = false;

                GameObject speech_Level2Trigger1 = GameObject.Find("MFPLevel/SpeechTriggers/trigger1");
                GameObject speech_Level2Pedro1   = RuntimeEntities.SpawnPedro(GameObject.Find("MFPLevel/Pedro").transform.position);

                // MFPClassicAssets.root.nrOfEnemiesTotal = enemies.Count / 2 - 6;

                enemies[0].standStill = true;

                enemies[1].playerDetectionRadius /= 1.5f;
                enemies[1].standStill             = true;

                enemies[3].standStill = true;
                enemies[3].faceRight  = false;

                enemies[4].playerDetectionRadius /= 1.5f;

                enemies[7].standStill = true;
                enemies[8].standStill = true;

                enemies[9].faceRight = false;

                enemies[11].standStill             = true;
                enemies[11].faceRight              = false;
                enemies[11].playerDetectionRadius *= 1.2f;
                enemies[11].standStillInHuntMode   = true;

                enemies[11].weapon = 6;
                enemies[11].disableWeaponPickup = true;

                RuntimeEntities.CreateChairEnemy(GameObject.Find("MFPLevel/WoodenChair/WoodenChair_0 (3)"), enemies[2], false);
                RuntimeEntities.CreateChairEnemy(GameObject.Find("MFPLevel/WoodenChair/WoodenChair_0 (1)"), enemies[4], false);

                RuntimeEntities.GenerateSpeechScript(speech_Level2Trigger1, speech_Level2Pedro1.transform, "Pedro", "pedro01_level2_MFPClassic", MFPClassicAssets.pedroSounds[UnityEngine.Random.Range(0, MFPClassicAssets.pedroSounds.Length)], true, speech_Level2Pedro1);
                break;


            case 3:

                SpawnDoorScript door1_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door1").transform.position, 5);
                SpawnDoorScript door2_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door2").transform.position, 5);
                SpawnDoorScript door3_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door3").transform.position, 1);
                SpawnDoorScript door4_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door4").transform.position, 1);
                SpawnDoorScript door5_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door5").transform.position, 1);
                SpawnDoorScript door6_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door6").transform.position, 1);
                SpawnDoorScript door7_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door7").transform.position, 1);
                SpawnDoorScript door8_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door8").transform.position, 1);
                SpawnDoorScript door9_level3  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door9").transform.position, 1);
                SpawnDoorScript door10_level3 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door10").transform.position, 2);
                SpawnDoorScript door11_level3 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door11").transform.position, 2);

                door1_level3.attackAfterDoorSpawn = true;

                door2_level3.inputSwitch           = new SwitchScript[] { door1_level3.GetSwitch() };
                door2_level3.attackAfterDoorSpawn  = true;
                door3_level3.attackAfterDoorSpawn  = true;
                door4_level3.attackAfterDoorSpawn  = true;
                door5_level3.attackAfterDoorSpawn  = true;
                door6_level3.attackAfterDoorSpawn  = true;
                door7_level3.attackAfterDoorSpawn  = true;
                door8_level3.attackAfterDoorSpawn  = true;
                door9_level3.attackAfterDoorSpawn  = true;
                door10_level3.attackAfterDoorSpawn = true;
                door11_level3.attackAfterDoorSpawn = true;

                ElevatorScript elevatorTrigger = GameObject.Find("MFPLevel/ElevatorEntranceTrigger").gameObject.AddComponent <ElevatorScript>();
                elevatorTrigger.spawnDoors = new SpawnDoorScript[] { door1_level3, door2_level3 };

                SwitchABMoveScript elevator = GameObject.Find("MFPLevel/Elevator").AddComponent <SwitchABMoveScript>();

                elevator.gameObject.AddComponent <SwitchScript>();

                elevator.outputOnReachedEnd          = true;
                elevator.gameObject.transform.parent = null;


                elevator.inputSwitch        = new SwitchScript[] { elevatorTrigger.GetSwitch() };
                elevatorTrigger.inputSwitch = elevator.GetSwitch();

                elevator.movePos = new Vector3(0, -11.54f, 0);

                elevator.moveSpeed    = 0.005552662f;
                elevator.acceleration = 0.1f;

                elevator.animLengthInFrames = 180;



                SimpleDoorTrigger doorTrig = GameObject.Find("MFPLevel/DoorTrigger").AddComponent <SimpleDoorTrigger>();
                doorTrig.spawnDoors = new SpawnDoorScript[] { door10_level3, door11_level3 };

                enemies[0].standStill           = true;
                enemies[0].standStillInHuntMode = true;
                enemies[0].weapon    = 1;
                enemies[0].faceRight = false;

                enemies[1].standStill = true;
                enemies[1].faceRight  = false;

                enemies[2].weapon = 3;
                enemies[4].weapon = 3;
                enemies[5].weapon = 3;

                enemies[8].weapon = 3;
                enemies[9].weapon = 6;

                enemies[10].weapon = 3;

                enemies[12].standStill = true;
                enemies[12].faceRight  = false;

                enemies[14].faceRight = true;
                enemies[15].faceRight = false;

                SimpleTriggerZoneSwitchScript endElevatorTrigger = GameObject.Find("MFPLevel/EndElevatorTrigger").AddComponent <SimpleTriggerZoneSwitchScript>();
                endElevatorTrigger.gameObject.AddComponent <SwitchScript>();
                endElevatorTrigger.enableOnEnter = true;



                SwitchABMoveScript endElevator = GameObject.Find("MFPLevel/EndElevator").AddComponent <SwitchABMoveScript>();
                endElevator.gameObject.AddComponent <SwitchScript>();

                endElevator.inputSwitch = new SwitchScript[] { endElevatorTrigger.GetSwitch() };

                endElevator.movePos      = new Vector3(0, 10, 0);
                endElevator.moveSpeed    = 0.005552662f;
                endElevator.acceleration = 0.1f;

                endElevator.animLengthInFrames = 180;



                break;

            case 4:

                GameObject.FindObjectOfType <BackgroundCameraScript>().transform.position += new Vector3(0, 0, 50);

                SpawnDoorScript door1_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door1").transform.position, 1);
                SpawnDoorScript door2_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door2").transform.position, 1);
                SpawnDoorScript door3_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door3").transform.position, 1);
                SpawnDoorScript door4_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door4").transform.position, 1);
                SpawnDoorScript door5_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door5").transform.position, 1);
                SpawnDoorScript door6_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door6").transform.position, 1);
                SpawnDoorScript door7_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door7").transform.position, 1);
                SpawnDoorScript door8_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door8").transform.position, 2);
                SpawnDoorScript door9_level4  = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door9").transform.position, 1);
                SpawnDoorScript door10_level4 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door10").transform.position, 1);
                SpawnDoorScript door11_level4 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door11").transform.position, 2);

                door10_level4.GetComponent <BoxCollider>().center -= new Vector3(0, 0, 50);
                door11_level4.GetComponent <BoxCollider>().center -= new Vector3(0, 0, 50);

                door1_level4.attackAfterDoorSpawn = true;
                door2_level4.attackAfterDoorSpawn = true;
                door3_level4.attackAfterDoorSpawn = true;
                door4_level4.attackAfterDoorSpawn = true;
                door5_level4.attackAfterDoorSpawn = true;

                door6_level4.attackAfterDoorSpawn = true;
                door6_level4.faceRight            = true;

                door7_level4.attackAfterDoorSpawn  = true;
                door8_level4.attackAfterDoorSpawn  = true;
                door9_level4.attackAfterDoorSpawn  = true;
                door10_level4.attackAfterDoorSpawn = true;
                door11_level4.attackAfterDoorSpawn = true;

                door2_level4.weapon  = 3;
                door4_level4.weapon  = 6;
                door7_level4.weapon  = 3;
                door10_level4.weapon = 3;

                door4_level4.inputSwitch = new SwitchScript[] { door3_level4.GetSwitch() };

                enemies[0].weapon    = 6;
                enemies[0].faceRight = false;

                enemies[2].weapon    = 3;
                enemies[2].faceRight = false;

                enemies[3].weapon    = 3;
                enemies[3].faceRight = false;

                enemies[4].weapon = 3;

                enemies[5].weapon    = 3;
                enemies[5].faceRight = false;

                enemies[7].faceRight = false;

                enemies[8].weapon     = 6;
                enemies[8].standStill = true;
                enemies[8].faceRight  = false;

                enemies[9].faceRight = false;

                enemies[12].faceRight = false;
                enemies[12].weapon    = 6;

                enemies[14].weapon               = 5;
                enemies[14].standStill           = true;
                enemies[14].standStillInHuntMode = true;
                enemies[14].faceRight            = false;
                enemies[14].disableWeaponPickup  = true;

                break;

            case 5:

                SpawnDoorScript door1_level5 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door1").transform.position, 1);
                SpawnDoorScript door2_level5 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door2").transform.position, 1);

                enemies[1].weapon = 3;
                enemies[2].weapon = 5;

                enemies[3].standStill = true;
                enemies[4].standStill = true;
                enemies[5].standStill = true;

                enemies[6].weapon = 5;

                enemies[7].faceRight = false;
                enemies[7].weapon    = 3;

                enemies[8].weapon = 6;

                enemies[9].weapon    = 6;
                enemies[9].faceRight = false;

                enemies[10].weapon = 5;
                enemies[11].weapon = 3;
                enemies[13].weapon = 5;

                enemies[14].weapon     = 3;
                enemies[14].standStill = true;

                enemies[15].weapon     = 3;
                enemies[15].standStill = true;

                enemies[16].weapon               = 5;
                enemies[16].standStill           = true;
                enemies[16].standStillInHuntMode = true;
                enemies[16].faceRight            = false;

                break;

            case 6:

                SpawnDoorScript door1_level6 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door1").transform.position, 1);
                SpawnDoorScript door2_level6 = RuntimeEntities.CreateEnemyDoor(GameObject.Find("MFPLevel/DoorSpawns/Door2").transform.position, 1);

                enemies[1].standStill           = true;
                enemies[1].standStillInHuntMode = true;

                enemies[3].faceRight            = true;
                enemies[3].standStillInHuntMode = true;
                enemies[3].standStill           = true;

                enemies[4].faceRight  = true;
                enemies[4].standStill = true;

                enemies[5].standStill = true;

                enemies[6].standStill           = true;
                enemies[6].standStillInHuntMode = true;
                enemies[6].faceRight            = true;

                enemies[13].standStill = true;

                break;

            case 8:

                MFPClassicAssets.root.dontAllowAutomaticFallDeath = true;
                // MFPClassicAssets.player.skyfall = true;

                Victor vic = GameObject.Find("MFPLevel/Victor").AddComponent <Victor>();
                vic.gameObject.AddComponent <VictorAnimEvents>();

                MFPClassicAssets.player.gameObject.AddComponent <PlayerWings>();

                SimpleTriggerZoneSwitchScript arenaZone = GameObject.Find("MFPLevel/ArenaBoundsActivator").AddComponent <SimpleTriggerZoneSwitchScript>();
                arenaZone.enableOnEnter = true;
                arenaZone.enableOnExit  = true;
                arenaZone.gameObject.AddComponent <SwitchScript>();

                InputSetActiveScript arenaSwitch = new GameObject().AddComponent <InputSetActiveScript>();
                arenaSwitch.activatableObjects = new GameObject[] { GameObject.Find("MFPLevel/Cube") };

                arenaSwitch.inputSwitch = arenaZone.GetSwitch();


                AutoControlZoneScript flyZone = RuntimeEntities.GenerateAutoControlZone(GameObject.Find("MFPLevel/AutoControlFly"));

                flyZone.jump = true;
                flyZone.enableOverrideOnEnter = true;
                flyZone.setAim = true;
                flyZone.aimPos = new Vector3(15, 0, 0);



                FinalBattleController finalBattle = new GameObject().AddComponent <FinalBattleController>();
                finalBattle.startSwitch = arenaZone.GetSwitch();

                new GameObject().AddComponent <CheckpointScript>().triggerFromSwitch = arenaZone.GetSwitch();


                GameObject.FindObjectOfType <CameraScript>().gameObject.AddComponent <SimpleTrackPlayer>();


                isBossLevel = true;

                //CHECKPOINT İÇİN AUTOCONTROLÜN HEMEN EN SONUNA TRİGGER KOY


                break;
            }


            List <Transform> enemiesRoot = new List <Transform>();

            foreach (EnemyScript enemy in enemies)
            {
                enemiesRoot.Add(enemy.transform);
            }

            MFPClassicAssets.root.allEnemies = enemiesRoot.ToArray();

            MFPEditorUtils.Log("Map loaded");
        }
Beispiel #20
0
        public IEnumerator DoAttack(VictorAttacks attackType)
        {
            if (attacking)
            {
                MFPEditorUtils.Log("already attacking");
                yield break;
            }

            attacking     = true;
            currentAttack = attackType;
            switch (attackType)
            {
            case VictorAttacks.BulletMouth:


                if (!bursting)
                {
                    burstAmount = UnityEngine.Random.Range(1, 3);
                    bursting    = true;
                }

                lookAt = true;
                MoveJaw(2, true);

                while (jawMoving)
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds((player.dodgingCoolDown <= 0 ? UnityEngine.Random.Range(0.5f, 1.7f) : player.dodgingCoolDown / 30)));


                int nrOfBullets = 0;

                float attackDelay = 0;

                switch (root.difficultyMode)
                {
                case 0:
                    nrOfBullets = UnityEngine.Random.Range(6, 11);
                    attackDelay = 0.2f;
                    break;

                case 1:
                    goto case 0;

                case 2:
                    nrOfBullets = UnityEngine.Random.Range(8, 13);
                    attackDelay = 0.1f;
                    break;
                }

                while (nrOfBullets != 0)
                {
                    root.getBullet(shootNode.transform.position, Quaternion.LookRotation(shootNode.transform.forward));

                    BulletScript bulletScript = root.getBulletScript();
                    bulletScript.bulletStrength = 0.35f;
                    bulletScript.bulletSpeed    = 10f;
                    bulletScript.friendly       = false;
                    bulletScript.doPostSetup();

                    nrOfBullets--;

                    yield return(new WaitForSeconds(attackDelay));
                }


                if (bursting && burstAmount == 0)
                {
                    bursting = false;
                }

                if (bursting && burstAmount > 0)
                {
                    attacking = false;
                    burstAmount--;
                    StartCoroutine(DoAttack(currentAttack));

                    yield break;
                }


                break;

            case VictorAttacks.LittleHeads:
                lookAt = true;
                MoveJaw(2);

                while (jawMoving)
                {
                    yield return(null);
                }

                if (!bursting)
                {
                    burstAmount = 1;
                    bursting    = true;
                }


                yield return(new WaitForSeconds(1.3f));

                int nrOfHeads = 0;

                switch (root.difficultyMode)
                {
                case 0: nrOfHeads = Random.Range(2, 5); break;

                case 1: nrOfHeads = Random.Range(3, 6); break;

                case 2: nrOfHeads = Random.Range(5, 7); break;
                }


                //TODO: Maybe pool them?
                while (nrOfHeads != 0)
                {
                    if (player.health <= 0)
                    {
                        yield break;
                    }

                    GameObject miniVic = Instantiate(MFPClassicAssets.miniVictor);
                    miniVic.transform.position = new Vector3(shootNode.transform.position.x, shootNode.transform.position.y, miniVic.transform.position.z);

                    nrOfHeads--;

                    yield return(new WaitForSeconds(0.5f));
                }


                if (bursting && burstAmount > 0)
                {
                    attacking = false;
                    burstAmount--;
                    yield return(new WaitForSeconds(1));

                    StartCoroutine(DoAttack(currentAttack));

                    yield break;
                }


                if (bursting && burstAmount == 0)     //some shitty bug keeps LittleHeads from iterating properly
                {
                    attacking = false;
                    lookAt    = false;
                    bursting  = false;

                    yield break;
                }


                break;

            case VictorAttacks.Spatula:

                arm.gameObject.SetActive(true);


                Quaternion armStartRot = arm.rotation;


                float aimTime = 0;
                float curTime = 0;

                switch (root.difficultyMode)
                {
                case 0: aimTime = Random.Range(1.4f, 2.5f); break;

                case 1: aimTime = Random.Range(1.4f, 2.3f); break;

                case 2: aimTime = Random.Range(1.1f, 2f); break;
                }

                while (curTime < aimTime)
                {
                    if (root.paused || root.dead)
                    {
                        yield return(null);
                    }

                    Vector3 dir2 = (player.transform.position + new Vector3(60, 100, -25f)) - transform.position;

                    float angle2 = Mathf.Atan2(dir2.y, dir2.x) * Mathf.Rad2Deg;


                    arm.transform.localPosition = Vector3.Lerp(arm.transform.localPosition, spatulaArmEndPoint, 0.03f);
                    arm.transform.rotation      = Quaternion.Lerp(armStartRot, Quaternion.AngleAxis(angle2, Vector3.forward), 1);

                    curTime += Time.deltaTime;

                    yield return(null);
                }

                float targetSwingBackTime = 0.3f;
                float curSwingBackTime    = 0;

                while (curSwingBackTime < targetSwingBackTime)
                {
                    if (root.paused || root.dead)
                    {
                        yield return(null);
                    }

                    arm.Rotate(transform.forward * swingSpeed);

                    curSwingBackTime += Time.deltaTime;
                    yield return(null);
                }


                yield return(new WaitForSeconds(0.2f));

                float targetSwingTime = 0.3f;
                float curSwingTime    = 0;

                spatula.swinging = true;

                while (curSwingTime < targetSwingTime)
                {
                    if (root.paused || root.dead)
                    {
                        yield return(null);
                    }

                    arm.transform.position = Vector3.Lerp(arm.transform.position, arm.transform.position + (arm.transform.forward * 1.1f), 0.3f);
                    arm.Rotate(-transform.forward * (swingSpeed * 6));

                    curSwingTime += Time.deltaTime;
                    yield return(null);
                }

                spatula.swinging = false;


                yield return(new WaitForSeconds(2));

                arm.transform.rotation = armStartRot;
                arm.transform.position = spatulaArmStartPoint.position;
                arm.gameObject.SetActive(false);

                break;
            }


            attacking = false;
            lookAt    = false;
            MoveJaw(1);

            yield return(new WaitForSeconds(2));

            yield return(null);
        }
        public void Awake()
        {
            music              = new GameObject().AddComponent <AudioSource>();
            music.loop         = false;
            music.spatialBlend = 0;

            music.outputAudioMixerGroup = GameObject.Find("Root/Music").GetComponentInChildren <AudioSource>().outputAudioMixerGroup;
            GameObject.Find("Root/Music").SetActive(false);

            MFPEditorUtils.Log(MapManager.currentLevel.ToString());

            musicData = new MusicDefinition();

            switch (MapManager.currentLevel)
            {
            case 1:
                musicData.loop = MFPClassicAssets.classicBundle.LoadAsset("tutorial_music_1") as AudioClip;
                break;

            case 2:
                introOverride = true;

                musicData.intro = MFPClassicAssets.classicBundle.LoadAsset("music1Intro") as AudioClip;
                musicData.loop  = MFPClassicAssets.classicBundle.LoadAsset("music1") as AudioClip;
                break;

            case 3:
                musicData.loop = MFPClassicAssets.classicBundle.LoadAsset("music2") as AudioClip;
                break;

            case 4:
                introOverride = true;

                musicData.intro = MFPClassicAssets.classicBundle.LoadAsset("music3Intro") as AudioClip;
                musicData.loop  = MFPClassicAssets.classicBundle.LoadAsset("music3") as AudioClip;
                break;

            case 5:
                musicData.loop = MFPClassicAssets.classicBundle.LoadAsset("music4") as AudioClip;
                break;

            case 6:
                musicData.loop = MFPClassicAssets.classicBundle.LoadAsset("music5") as AudioClip;
                break;

            case 8:
                musicData.loop = MFPClassicAssets.classicBundle.LoadAsset("bossLoop") as AudioClip;
                break;
            }

            if (musicData.intro != null || musicData.loop != null)
            {
                MFPEditorUtils.Log("Custom music loaded");
            }

            if (musicData.intro != null)
            {
                music.clip = musicData.intro;

                if (introOverride)
                {
                    music.loop = true;
                }

                music.Play();
            }
            else
            {
                SwitchtoActionMusic();
            }
        }
Beispiel #22
0
        public IEnumerator MoveJawCoroutine(float target)
        {
            jawMoving = true;


            MFPEditorUtils.Log(target.ToString());

            if (target > currentJawIntensity)
            {
                while (currentJawIntensity < target)
                {
                    if (root.paused || root.dead)
                    {
                        yield return(null);
                    }

                    if (cancelJawDoOnce)
                    {
                        jawMoving       = false;
                        cancelJawDoOnce = false;
                        yield break;
                    }

                    float yAmount = Mathf.Clamp(head.transform.localPosition.y + jawSpeed, jawMin, jawMax);
                    head.transform.localPosition = new Vector3(head.transform.localPosition.x, yAmount, head.transform.localPosition.z);
                    currentJawIntensity          = yAmount;

                    yield return(null);
                }
            }
            else
            {
                while (currentJawIntensity > target)
                {
                    if (root.paused || root.dead)
                    {
                        yield return(null);
                    }


                    if (cancelJawDoOnce)
                    {
                        jawMoving       = false;
                        cancelJawDoOnce = false;
                        yield break;
                    }


                    float yAmount = Mathf.Clamp(head.transform.localPosition.y - jawSpeed, jawMin, jawMax);
                    head.transform.localPosition = new Vector3(head.transform.localPosition.x, yAmount, head.transform.localPosition.z);
                    currentJawIntensity          = yAmount;

                    yield return(null);
                }
            }

            head.transform.localPosition = new Vector3(head.transform.localPosition.x, target, head.transform.localPosition.z);
            currentJawIntensity          = target;

            jawMoving = false;
        }