예제 #1
0
    //fine variabili primo livello

    // Use this for initialization
    void Start()
    {
        isys   = GameObject.FindGameObjectWithTag("Player").GetComponent <InventorySystem>();
        hud    = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
        player = GameObject.FindGameObjectWithTag("Player");
        misc   = player.GetComponent <Misc>();
    }
예제 #2
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
예제 #3
0
        private void CreateHudSystem()
        {
            HUDSystem = new HUDSystem(Content.Load <SpriteFont>("Fonts/HUDFont"), Content);

            // Create the debugging widget (Only shows in admin mode)
            _debugWidget = new TextWidget(_gameInfo, HUDAlignment.BottomLeft, i => i.Fsm.ToString());

            // Create an avatar widget
            var avatarWidget = new AvatarWidget(_gameInfo, HUDAlignment.TopLeft);

            HUDSystem.Add(avatarWidget);

            // Create a widget for the game type that the user will be playing
            HUDWiget gameTypeWidget = null;

            switch (_gameInfo.GameRuleType)
            {
            case GameRuleType.Retirement: gameTypeWidget = new AgeCounterWidget(_gameInfo, HUDAlignment.TopCenter); break;

            case GameRuleType.Passport: gameTypeWidget = new PassportWidget(_gameInfo, HUDAlignment.TopCenter); break;
            }
            HUDSystem.Add(gameTypeWidget);

            // Create the current highscore list widget
            var highscoreList = new Leaderboarder(_gameInfo, HUDAlignment.TopRight);

            HUDSystem.Add(highscoreList);

            ScreenManager.AddGameLayer(HUDSystem, true);
        }
예제 #4
0
 /// <summary>
 /// setting the players current health to the starting health of the player
 /// We cache the Scripts needed here
 /// </summary>
 private void Awake()
 {
     playerStats   = FindObjectOfType <PlayerStats>();
     currentHealth = playerStats.playerStartingHealth;
     m_hudSystem   = FindObjectOfType <HUDSystem>();
     storedHealth  = currentHealth;
 }
예제 #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Create game systems
            InputSystem              = new InputSystem(this);
            NetworkSystem            = new NetworkSystem(this);
            RenderingSystem          = new RenderingSystem(this);
            MovementSystem           = new MovementSystem(this);
            WeaponSystem             = new WeaponSystem(this);
            EnemyAISystem            = new EnemyAISystem(this);
            NpcAISystem              = new NpcAISystem(this);
            GarbagemanSystem         = new GarbagemanSystem(this);
            CollisionSystem          = new Systems.CollisionSystem(this);
            RoomChangingSystem       = new RoomChangingSystem(this);
            QuestLogSystem           = new QuestLogSystem(this);
            SpriteAnimationSystem    = new SpriteAnimationSystem(this);
            SkillSystem              = new SkillSystem(this);
            TextSystem               = new TextSystem(this);
            EngineeringOffenseSystem = new EngineeringOffenseSystem(this);
            HUDSystem = new HUDSystem(this);

            InputHelper.Load();
            HUDSystem.LoadContent();

            // Testing code.
            LevelManager.LoadContent();
            LevelManager.LoadLevel("D01F01R01");
            //Song bg = Content.Load<Song>("Audio/Main_Loop");
            //MediaPlayer.Stop();
            //MediaPlayer.IsRepeating = true;
            //MediaPlayer.Play(bg);
            //End Testing Code
        }
 // Use this for initialization
 void Start()
 {
     hud    = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem> ();
     player = GameObject.FindGameObjectWithTag("Player");
     //ChainSpawn=GameObject.FindGameObjectWithTag("ChainEnemySpawn");
     //CutterSpawn = GameObject.FindGameObjectWithTag("CutterEnemySpawn");
     misc = player.GetComponent <Misc>();
 }
 // Use this for initialization
 void Start()
 {
     //Assegnazione variabili
     inventario  = GetComponent <InventorySystem>();
     smg_imp     = GameObject.Find("MP5 (Impugnato)");
     cc          = GetComponent <CharacterController>();
     hud         = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
     pistola_imp = GameObject.Find("P226 (Impugnata)");
     ascia_imp   = GameObject.Find("l'ascia (Impugnata)");
     smg_imp     = GameObject.Find("MP5 (Impugnato)");
 }
예제 #8
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();

        inventario = GameObject.FindGameObjectWithTag("Player").GetComponent <InventorySystem>();
        hudsystem  = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();

        tpsCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();

        playsound = GameObject.FindGameObjectWithTag("Player").GetComponent <PlaySound>();
    }
    public void Start()
    {
        access_cutter = GameObject.FindGameObjectWithTag("Cutter").GetComponent <KeyScript>();
        access_key    = GameObject.FindGameObjectWithTag("FinalKey").GetComponent <KeyScript>();
        hud           = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem> ();

        if (gameObject.name.Equals("MusicaFondo"))
        {
            GetComponent <AudioSource>().Play();
        }
    }
예제 #10
0
    // Start is called before the first frame update
    void Start()
    {
        HUDSystem.ResetGame();
        for (int i = 0; i < 3; i++)
        {
            SpawnPiece(Element.Fire);
            SpawnPiece(Element.Ice);
            SpawnPiece(Element.Lightning);
        }

        Startup.ChangeAudioTrack(Startup.Track.Game);
    }
예제 #11
0
    // Use this for initialization
    void Start()
    {
        shutter1   = GameObject.FindGameObjectWithTag("Serranda");
        boss_door1 = GameObject.Find("door_2");

        if (gameObject.name.Equals("boss_door"))
        {
            boss1 = GameObject.FindGameObjectWithTag("MiniBoss");
            boss1.SetActive(false);
        }
        hud            = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
        boss_is_active = false;
    }
예제 #12
0
 public void EnterWorld(int mapID)
 {
     Ect      = new EffectSystem();
     Fly      = new FlywordSystem();
     Hud      = new HUDSystem();
     Act      = new ActSystem();
     Nts      = new NodeTreeSystem();
     Plt      = new PlotSystem();
     Cut      = new VideoSystem();
     WorldMap = new GameObject("FTWorldMap").AddComponent <FTWorldMap>();
     WorldMap.MapLoadFinish = OnLoadMapFinished;
     WorldMap.EnterWorld(mapID);
 }
예제 #13
0
    public int upgradePoints; // used to set the players level number



    /// <summary>
    /// adds experience whenever this function is called, mostly on death from the enemy script
    /// </summary>
    /// <param name="xpAmount"></param> Amount of XP to gain parameter, This is based and set from the enemy death script
    public void AddExperience(int xpAmount)
    {
        experience += xpAmount;
        HUDSystem hud = FindObjectOfType <HUDSystem>();

        hud.UpdateHud();
        if (experience >= experienceToNextLevel)
        {
            level++;
            upgradePoints++;
            experience = experienceToNextLevel;
            IncreaseXPNeeded(0, 100 * level * Mathf.Pow(level, 0.5f));
        }
    }
예제 #14
0
    // Use this for initialization
    void Start()
    {
        hud    = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
        player = GameObject.FindGameObjectWithTag("Player");
        hud.centralBoxEnabler(false);
        hud.sideBoxEnabler(false);
        animator   = player.GetComponent <Animator>();
        inventario = player.GetComponent <InventorySystem>();

        //AxeSpawn=GameObject.FindGameObjectWithTag("AxeEnemySpawn");
        //PistolSpawn=GameObject.FindGameObjectWithTag("PistolEnemySpawn");
        //ChainSpawn = GameObject.FindGameObjectWithTag("ChainEnemySpawn");
        //CutterSpawn = GameObject.FindGameObjectWithTag("CutterEnemySpawn");
        //SmgSpawn = GameObject.FindGameObjectWithTag("SmgEnemySpawn");

        munizioni_ammobox = start_ammo;//Setto le munizioni contenute nell'ammo box

        misc = player.GetComponent <Misc>();
    }
예제 #15
0
    public static void DamagePlayer(int player, float amount)
    {
        playerHealths[player - 1] -= amount;
        if (playerHealths[player - 1] < 0)
        {
            if (player == 1)
            {
                Startup.ChangeAudioTrack(Startup.Track.Victory);
                UnityEngine.SceneManagement.SceneManager.LoadScene("End Screen", UnityEngine.SceneManagement.LoadSceneMode.Single);
            }
            else if (player == 2)
            {
                Startup.ChangeAudioTrack(Startup.Track.Victory);
                UnityEngine.SceneManagement.SceneManager.LoadScene("End Screen 2", UnityEngine.SceneManagement.LoadSceneMode.Single);
            }
        }

        HUDSystem.UpdateHealth(player, playerHealths[player - 1]);
    }
예제 #16
0
 public void EnterWorld(int mapID)
 {
     Lvl = GameObject.FindObjectOfType <LevelSystem>();
     if (Lvl == null)
     {
         GameObject go = new GameObject("LevelSystem");
         Lvl = go.AddComponent <LevelSystem>();
     }
     else
     {
         Lvl.DelAllElements();
     }
     CharacterManager.Instance.SetRoot(Lvl.transform);
     Ect    = new EffectSystem();
     Fly    = new FlywordSystem();
     Hud    = new HUDSystem();
     Act    = new ActSystem();
     Nts    = new NodeTreeSystem();
     Plt    = new PlotSystem();
     Cut    = new VideoSystem();
     Lvl.Id = mapID;
     Lvl.Startup();
 }
    public void Load_(string scene_name)
    {
        if (File.Exists(Application.persistentDataPath + "/save.dat"))
        {
            isys   = GameObject.FindGameObjectWithTag("Player").GetComponent <InventorySystem>();
            hud    = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
            player = GameObject.FindGameObjectWithTag("Player");
            misc   = player.GetComponent <Misc>();
            //AxeSpawn =GameObject.FindGameObjectWithTag("AxeEnemySpawn");
            //PistolSpawn = GameObject.FindGameObjectWithTag("PistolEnemySpawn"); ;
            //ChainSpawn = GameObject.FindGameObjectWithTag("ChainEnemySpawn"); ;
            //CutterSpawn = GameObject.FindGameObjectWithTag("CutterEnemySpawn"); ;
            //SmgSpawn = GameObject.FindGameObjectWithTag("SmgEnemySpawn"); ;

            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      file      = File.Open(Application.persistentDataPath + "/save.dat", FileMode.Open);

            SceneData data = (SceneData)formatter.Deserialize(file);
            file.Close();

            isys.LoadPlayer(data.pdata);

            //Valido per il primo livello
            if (scene_name.Equals("Scena 1 - Il massiccio"))
            {
                Save.AxeSpawnActive = data.spawn.AxeSpawnActive;
                if (data.spawn.AxeSpawnActive)
                {
                    AxeSpawn.SetActive(true);
                }
                else
                {
                    AxeSpawn.SetActive(false);
                }

                Save.PistolSpawnActive = data.spawn.PistolSpawnActive;
                if (data.spawn.PistolSpawnActive)
                {
                    PistolSpawn.SetActive(true);
                }
                else
                {
                    PistolSpawn.SetActive(false);
                }

                Save.ChainSpawnActive = data.spawn.ChainSpawnActive;
                if (data.spawn.ChainSpawnActive)
                {
                    ChainSpawn.SetActive(true);
                }
                else
                {
                    ChainSpawn.SetActive(false);
                }

                Save.CutterSpawnActive = data.spawn.CutterSpawnActive;
                if (data.spawn.CutterSpawnActive)
                {
                    CutterSpawn.SetActive(true);
                }
                else
                {
                    CutterSpawn.SetActive(false);
                }

                Save.SmgSpawnActive = data.spawn.SmgSpawnActive;
                if (data.spawn.SmgSpawnActive)
                {
                    SmgSpawn.SetActive(true);
                }
                else
                {
                    SmgSpawn.SetActive(false);
                }
            }

            //Per ogni nemico nella scena (inizialmente sono tutti attivi, anche quelli da spawnare via script)
            foreach (GameObject nemico in GameObject.FindGameObjectsWithTag("Enemy"))
            {
                //Per ogni enemydata presente nella lista degli enemy salvatii
                foreach (Enemy enemy in data.edata)
                {
                    //Se il nome del nemico è presente nella lista, allora carico le sue info
                    if (nemico.gameObject.name.Equals(enemy.name))
                    {
                        nemico.GetComponent <EnemyController>().loadEnemy(enemy);
                        nemico.GetComponent <EnemyController>().loaded = true;
                    }
                }
            }

            //Elimino i nemici che non sono stati caricati
            foreach (GameObject nemico in GameObject.FindGameObjectsWithTag("Enemy"))
            {
                if (nemico.GetComponent <EnemyController>().loaded == false)
                {
                    Destroy(nemico);
                }
            }

            //Trovo gli elementi da mantenere nella scena, impostando a true loaded (quelli a false andranno eliminati nel prossimo ciclo for)
            foreach (string nome in data.idata)
            {
                foreach (GameObject kitmedico in GameObject.FindGameObjectsWithTag("FirstAid"))
                {
                    if (kitmedico.gameObject.name.Equals(nome))
                    {
                        kitmedico.GetComponent <Pickup>().loaded = true;
                    }
                }

                foreach (GameObject ammo_9mm in GameObject.FindGameObjectsWithTag("Ammo_9mm"))
                {
                    if (ammo_9mm.gameObject.name.Equals(nome))
                    {
                        ammo_9mm.GetComponent <Pickup>().loaded = true;
                    }
                }

                foreach (GameObject ammo_smg in GameObject.FindGameObjectsWithTag("Ammo_smg"))
                {
                    if (ammo_smg.gameObject.name.Equals(nome))
                    {
                        ammo_smg.GetComponent <Pickup>().loaded = true;
                    }
                }

                if (torcia != null && torcia.gameObject.name.Equals(nome))
                {
                    torcia.GetComponent <Pickup>().loaded = true;
                }

                if (ascia != null && ascia.gameObject.name.Equals(nome))
                {
                    ascia.GetComponent <Pickup>().loaded = true;
                }

                if (pistola != null && pistola.gameObject.name.Equals(nome))
                {
                    pistola.GetComponent <Pickup>().loaded = true;
                }

                if (smg != null && smg.gameObject.name.Equals(nome))
                {
                    smg.GetComponent <Pickup>().loaded = true;
                }

                //Valido per il primo livello
                if (scene_name.Equals("Scena 1 - Il massiccio"))
                {
                    if (final_key != null && final_key.gameObject.name.Equals(nome))
                    {
                        final_key.GetComponent <KeyScript>().loaded = true;
                    }

                    if (cutter != null && cutter.gameObject.name.Equals(nome))
                    {
                        cutter.GetComponent <KeyScript>().loaded = true;
                    }
                }
            }

            //Elimino gli oggetti che non servono
            foreach (GameObject kitmedico in GameObject.FindGameObjectsWithTag("FirstAid"))
            {
                if (kitmedico.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(kitmedico);
                }
            }

            foreach (GameObject ammo_9mm in GameObject.FindGameObjectsWithTag("Ammo_9mm"))
            {
                if (ammo_9mm.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(ammo_9mm);
                }
            }

            foreach (GameObject ammo_smg in GameObject.FindGameObjectsWithTag("Ammo_smg"))
            {
                if (ammo_smg.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(ammo_smg);
                }
            }


            //Valido per il primo livello
            if (scene_name.Equals("Scena 1 - Il massiccio"))
            {
                if (torcia != null && torcia.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(torcia);
                }

                if (ascia != null && ascia.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(ascia);
                }

                if (pistola != null && pistola.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(pistola);
                }

                if (smg != null && smg.GetComponent <Pickup>().loaded == false)
                {
                    Destroy(smg);
                }

                if (final_key != null && final_key.GetComponent <KeyScript>().loaded == false)
                {
                    Destroy(final_key);
                }

                if (cutter != null && cutter.GetComponent <KeyScript>().loaded == false)
                {
                    Destroy(cutter);
                }
            }

            //Setto gli eventi
            if (data.checkpoint_name.Equals("Pre-MiniBoss"))
            {
                GameObject.FindGameObjectWithTag("Recinzione").GetComponent <Animator>().SetBool("Open", true);
            }

            if (data.checkpoint_name.Equals("Post-MiniBoss"))
            {
                Destroy(GameObject.FindGameObjectWithTag("MiniBoss"));
                boss_door1.GetComponent <Animator>().SetTrigger("Boss dies");
            }

            if (data.checkpoint_name.Equals("Pre-Boss"))
            {
                foreach (GameObject porta in GameObject.FindGameObjectsWithTag("Porta"))
                {
                    if (porta.GetComponent <DoorBrokenDown>() != null)
                    {
                        porta.GetComponent <DoorBrokenDown>().brokenOnLoading();
                    }
                }

                Destroy(GameObject.Find("WeaponsCrate"));
                Destroy(GameObject.Find("crate"));
            }

            if (data.checkpoint_name.Equals("Checkpoint1"))
            {
                foreach (GameObject porta in GameObject.FindGameObjectsWithTag("PortaCheckpoint"))
                {
                    if (porta != null && porta.name.Equals("PortaPostCheckpoint1"))
                    {
                        porta.GetComponentInChildren <OpenCloseDoor>().unlocked = false;
                        porta.GetComponentInChildren <Animator>().SetBool("open", false);
                    }
                }

                if (GameObject.FindGameObjectWithTag("Porta") != null)
                {
                    GameObject.FindGameObjectWithTag("Porta").GetComponent <OpenCloseDoor>().unlocked = true;
                }
            }
            if (data.checkpoint_name.Equals("Checkpoint2"))
            {
                print("we");
                foreach (GameObject porta in GameObject.FindGameObjectsWithTag("PortaCheckpoint"))
                {
                    if (porta != null && porta.name.Equals("PortaPostCheckpoint2"))
                    {
                        porta.GetComponentInChildren <OpenCloseDoor>().unlocked = false;
                        porta.GetComponentInChildren <Animator>().SetBool("open", false);
                    }
                }
            }

            Destroy(GameObject.Find(data.checkpoint_name));

            foreach (GameObject checkpoint_scena in GameObject.FindGameObjectsWithTag("Checkpoint"))
            {
                foreach (string checkpoint_save in data.check_data)
                {
                    print(checkpoint_save);
                    if (checkpoint_scena.name.Equals(checkpoint_save))
                    {
                        checkpoint_scena.GetComponent <Save>().loaded = true;
                    }
                }
            }

            foreach (GameObject checkpoint_scena in GameObject.FindGameObjectsWithTag("Checkpoint"))
            {
                if (checkpoint_scena.GetComponent <Save>().loaded == false)
                {
                    Destroy(checkpoint_scena);
                }
                else
                {
                    //Valido per il primo livello
                    if (scene_name.Equals("Scena 1 - Il massiccio"))
                    {
                        checkpoint_scena.GetComponent <Save>().AxeSpawn = AxeSpawn;
                        print(checkpoint_scena.GetComponent <Save>().AxeSpawn);
                        checkpoint_scena.GetComponent <Save>().PistolSpawn = PistolSpawn;
                        checkpoint_scena.GetComponent <Save>().ChainSpawn  = ChainSpawn;
                        checkpoint_scena.GetComponent <Save>().CutterSpawn = CutterSpawn;
                        checkpoint_scena.GetComponent <Save>().SmgSpawn    = SmgSpawn;
                    }
                }
            }
        }
    }
    public static bool snow = true; //true=a contatto con il terreno innevato


    // Use this for initialization
    void Start()
    {
        animator  = GetComponent <Animator>();
        hudsystem = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDSystem>();
        playsound = GetComponent <PlaySound>();
    }
예제 #19
0
 private void OnEnable()
 {
     playerHealth = FindObjectOfType <Player>();
     currentStats = FindObjectOfType <PlayerStats>();
     healthUpdate = FindObjectOfType <HUDSystem>();
 }
예제 #20
0
 // Token: 0x0600039D RID: 925 RVA: 0x000261E8 File Offset: 0x000243E8
 private void CreateArrow(HUDSystem hudSystem, Entity entity, GameObject iconPrefab, SceneExtractionZoneEntity sceneObject, float altitudeOffset, string labelText, Color iconColour)
 {
     // MOD: disable the arrow above ezs
     return;
     // MOD
 }