示例#1
0
文件: Actor.cs 项目: jrs1498/GDDGame1
 //-------------------------------------------------------------------------
 /// <summary>
 /// Default GameObject constructor
 /// </summary>
 public Actor(GameLevelManager gameLevelMgr)
 {
     _gameLevelMgr   = gameLevelMgr;
     _position       = Vector2.Zero;
     _scale          = new Vector2(1.0f);
     _rotation       = 0.0f;
 }
 public void EnableLocalHeatDistortion(bool isOn)
 {
     if (isOn)
     {
         if (GameLevelManager.IsPostProcessReachQuality(250))
         {
             if (CamerasMgr.MainCameraRoot == null)
             {
                 return;
             }
             EventDispatcher.Broadcast <bool, RTManager.RtType>("RTManager.ENABLE_PROJECTION_TYPE", true, RTManager.RtType.LocalHeatDistortion);
             if (this.m_LocalHeatDistortion == null)
             {
                 this.m_LocalHeatDistortion = CamerasMgr.MainCameraRoot.get_gameObject().AddMissingComponent <LocalHeatDistortion>();
                 this.m_LocalHeatDistortion.Initialization();
                 this.m_LocalHeatDistortion.set_enabled(isOn);
             }
         }
     }
     else
     {
         EventDispatcher.Broadcast <bool, RTManager.RtType>("RTManager.ENABLE_PROJECTION_TYPE", false, RTManager.RtType.LocalHeatDistortion);
         if (this.m_LocalHeatDistortion != null)
         {
             this.m_LocalHeatDistortion.set_enabled(false);
         }
     }
 }
    private void EnableBloom(bool isOn)
    {
        if (CamerasMgr.MainCameraRoot == null)
        {
            return;
        }
        int lod = 250;

        if (Application.get_platform() == 11)
        {
            lod = 300;
        }
        else if (Application.get_platform() == 8)
        {
            lod = 300;
        }
        if (isOn && GameLevelManager.IsPostProcessReachQuality(lod) && SystemConfig.PP_BloomOn)
        {
            if (this.m_BloomOptimized == null)
            {
                this.m_BloomOptimized = CamerasMgr.MainCameraRoot.get_gameObject().AddComponent <BloomOptimized>();
            }
            this.m_BloomOptimized.set_enabled(isOn);
            this.m_BloomOptimized.Initialization();
        }
        else if (this.m_BloomOptimized != null)
        {
            this.m_BloomOptimized.set_enabled(false);
        }
    }
 private void EnableRain(bool bEnable)
 {
     if (GameLevelManager.IsPostProcessReachQuality(250) && RainEffectManager.Instance != null)
     {
         RainEffectManager.Instance.EnableRain(bEnable);
     }
 }
 private void EnableMotionBlurSimple(bool isOn, Vector3 pos)
 {
     if (CamerasMgr.MainCameraRoot == null)
     {
         return;
     }
     if (SystemInfo.get_deviceModel().Contains("M3"))
     {
         return;
     }
     if (isOn && SystemConfig.PP_MotionBlurOn)
     {
         if (GameLevelManager.IsPostProcessReachQuality(250))
         {
             if (this.m_PP_RadialBlur == null)
             {
                 this.m_PP_RadialBlur = CamerasMgr.MainCameraRoot.get_gameObject().AddComponent <PP_RadialBlur>();
             }
             this.m_PP_RadialBlur.set_enabled(isOn);
             this.m_PP_RadialBlur.Initialization(pos);
         }
     }
     else if (this.m_PP_RadialBlur != null)
     {
         this.m_PP_RadialBlur.set_enabled(false);
     }
 }
示例#6
0
    public static void PlayMusic()
    {
        AudioSource MusicSource = GameObject.Find("AudioSFX").GetComponent <AudioSource>();

        if (GameLevelManager.GetSceneName() == "Main Menu")
        {
            MusicSource.clip = Music[1];
            MusicSource.Play();
            MusicSource.loop = true;
        }
        else if (GameLevelManager.GetSceneName() == "World1_1")
        {
            MusicSource.clip = Music[0];
            MusicSource.Play();
            MusicSource.loop = true;
        }
        else if (GameLevelManager.GetSceneName() == "HighScoreManagement")
        {
            MusicSource.clip = Music[2];
            MusicSource.Play();
            MusicSource.loop = true;
        }
        else if (GameLevelManager.GetSceneName() == "boss")
        {
            MusicSource.clip = Music[3];
            MusicSource.Play();
            MusicSource.loop = true;
        }
        else if (GameLevelManager.GetSceneName() == "GameOver")
        {
            MusicSource.clip = Music[1];
            MusicSource.Play();
            MusicSource.loop = true;
        }
    }
示例#7
0
        private void CreateExplodingParticleEmmitor(Vector position)
        {
            ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0));

            e.EmitingTime       = 1f;
            e.EmmitingDirection = new Vector(1, 0);
            e.MinAngle          = (float)-Math.PI;
            e.MaxAngle          = (float)Math.PI;
            e.MinForce          = 10;
            e.MaxForce          = 15;
            e.MinLife           = 3f;
            e.MaxLife           = 3.5f;
            e.Position          = position;
            e.MinSize           = 0.2f;
            e.MaxSize           = 0.8f;
            e.Amount            = 100;
            e.SizeMultiplier    = 0;
            e.Infinite          = false;
            e.FireAll           = true;
            e.Enabled           = true;

            byte r = (byte)rand.Next(0, 255);
            byte g = (byte)rand.Next(0, 255);
            byte b = (byte)rand.Next(0, 255);

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = colors[rand.Next(colors.Count())];
            e.Factory = f;

            GameLevelManager.SendNewObject(mgr, e);
        }
示例#8
0
        private void CreateMovingParticleEmmitor(Vector position, Vector direction, float speed, float time)
        {
            ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0));

            e.Direction         = direction;
            e.EmmitingDirection = direction.Rotate(180);
            e.MinAngle          = (float)(-Math.PI);
            e.MaxAngle          = (float)(Math.PI);
            e.MinForce          = 1;
            e.MaxForce          = 2;
            e.MinLife           = 2f;
            e.MaxLife           = 2.5f;
            e.Position          = position;
            e.MinSize           = 0.2f;
            e.MaxSize           = 1;
            e.Amount            = 250;
            e.SizeMultiplier    = 0;
            e.Infinite          = true;
            e.Enabled           = false;

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = Color.FromArgb(125, 255, 20, 0);
            e.Factory = f;

            LinearMovementControl c = new LinearMovementControl();

            c.Speed = speed;
            e.AddControl(c);

            GameLevelManager.SendNewObject(mgr, e);
        }
示例#9
0
 private void OnEnable()
 {
     if (GameLevelManager.IsPostProcessReachQuality(1000) && this.m_DepthOfFieldOfUI == null)
     {
         this.m_DepthOfFieldOfUI = CamerasMgr.CameraUI.get_gameObject().AddComponent <DepthOfFieldOfUI>();
     }
 }
示例#10
0
 public static void RefreshShadows()
 {
     if (ShadowController.IsPreviousRealTimeShadowEnable != GameLevelManager.IsRealTimeShadowOn())
     {
         XDict <long, EntityParent> allEntities = EntityWorld.Instance.AllEntities;
         using (List <EntityParent> .Enumerator enumerator = allEntities.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 EntityParent current = enumerator.get_Current();
                 if (current != null & current.Actor)
                 {
                     if (ShadowController.IsPreviousRealTimeShadowEnable)
                     {
                         ShadowController.SetShadowModelRender(current.Actor.FixTransform, true);
                     }
                     else
                     {
                         ShadowProjector.ShowShadowProjector(current.Actor.FixTransform, true);
                     }
                     ShadowController.ShowShadow(current.ID, current.Actor.FixTransform, false, 0);
                 }
             }
         }
     }
     ShadowController.IsPreviousRealTimeShadowEnable = GameLevelManager.IsRealTimeShadowOn();
 }
示例#11
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Pivot" && this.gameObject.tag == "Camera Switch")               // CHANGE CAMERA POSITION
        {
            cameraManager.ChangeCamera();
            Destroy(this.gameObject);
        }
        if (other.gameObject.tag == "Pivot" && this.gameObject.tag == "TriggerSpawn")                   // SPAWN ENEMIES
        {
            SpawnerController.SpawnWave(this.transform.position, this.gameObject.name);
            Destroy(this.gameObject);
        }
        if (gameObject.tag == "End_Level" && other.gameObject.tag == "Pivot")
        {
            GameLevelManager.HighScore();
        }
        if (gameObject.tag == "End_Level" && other.gameObject.tag == "VFX")
        {
            if (GameLevelManager.GetSceneName() == "World1_1")
            {
                return;
            }
            else
            {
                GameLevelManager.LoadNextLevel();
            }
        }

        if (gameObject.name == "HighScores")
        {
            ToggleScoreONOFF();
        }

        if (gameObject.name == "Head" && other.gameObject.tag == "VFX")
        {
            Avatar.Stun();
        }
        if (gameObject.name == "tail" && other.gameObject.tag == "VFX")
        {
            Avatar.MakeAvatarJump();
        }


        if (gameObject.name == "Continue" && other.gameObject.tag == "VFX")
        {
            GameLevelManager.Continue();
            UIController.ResetScore();
        }
        if (gameObject.name == "Quit" && other.gameObject.tag == "VFX")
        {
            GameLevelManager.ReturnToMenu();
            UIController.ResetScore();
        }

        if (gameObject.name == "Crystal")
        {
            gameObject.GetComponent <ItemControl>().DamageBoss();
        }
    }
示例#12
0
 public static GameLevelManager getInstance()
 {
     if (instance == null)
     {
         instance = new GameLevelManager();
     }
     return(instance);
 }
示例#13
0
        private void CreateConstantSmokeEmmitor(Vector position)
        {
            ParticleEmmitor e = createConstantEmmitor(position);

            e.Factory = new ParticleSmokeFactory();

            GameLevelManager.SendNewObject(mgr, e);
        }
示例#14
0
 public void Quit()
 {
     Destroy(GameObject.Find("UI"));
     GameLevelManager.resetScore();
     CombatScript.resetHeroLife();
     PlayMusic.StopMusic();
     SceneManager.LoadScene("MainMenu");
     Pause.UnPause();
 }
示例#15
0
 //-------------------------------------------------------------------------
 public Camera2D(GameLevelManager gameLevelMgr)
     : base(gameLevelMgr)
 {
     _rotationZ = 0.0f;
     _rotationX = (float)(Math.PI / 6.0f);
     _zoom = 0.5f;
     _originIsometric = Vector2.Zero;
     update(0.0f);
 }
示例#16
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// GameNode constructor.
 /// </summary>
 /// <param name="gameLevelMgr">GameLevelManager containing this GameNode.</param>
 /// <param name="name">Name of this GameNode.</param>
 /// <param name="active">Initial active status.</param>
 public GameNode(GameLevelManager gameLevelMgr, String name)
     : base(gameLevelMgr)
 {
     _name                   = name;
     _parent                 = null;
     _children               = new Dictionary<string, GameNode>();
     _positionIsometric      = Vector3.Zero;
     _entity                 = null;
 }
示例#17
0
        private void Start()
        {
            if (_machine == null)
            {
                _machine = new Machine(moneyCost, sellPrice, moneyGame, spendTime);
            }
            _clients = new List <Client>();

            _gameLevelManager = FindObjectOfType <GameLevelManager>().GetComponent <GameLevelManager>();
        }
示例#18
0
 private void HealthCheck()
 {
     if (CurrentHealth.GetHealth() <= 0)
     {
         animations_Controller.SetDie = true;
         if (AnimatorInfo.GetCurrentAnimatorStateInfo(0).IsName("GameOver"))
         {
             GameLevelManager.LoadGameOver();
         }
     }
 }
示例#19
0
    // Use this for initialization
    void OnTriggerEnter2D(Collider2D coll)
    {
        ScoreManager score = ScoreManager.getInstance();

        score.resetScore();
        score.save();

        GameLevelManager game = GameLevelManager.getInstance();

        game.loadLevel();
    }
示例#20
0
 private static void UpdateScoreText()
 {
     if (GameLevelManager.GetSceneName() == "HighScoreManagement")
     {
         return;
     }
     else
     {
         ScoreDisplay.GetComponent <TextMesh>().text = scoreValue.ToString();
     }
 }
示例#21
0
 private static void SetShadow(int lod, bool init = false)
 {
     if (!init)
     {
         ShadowController.RefreshShadows();
     }
     else
     {
         ShadowController.IsPreviousRealTimeShadowEnable = GameLevelManager.IsRealTimeShadowOn();
     }
 }
示例#22
0
        private void CreateConstantParticleEmmitor(Vector position)
        {
            ParticleEmmitor e = createConstantEmmitor(position);

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = Color.FromArgb(20, 0, 0, 0);
            e.Factory = f;

            GameLevelManager.SendNewObject(mgr, e);
        }
示例#23
0
    // Use this for initialization
    void Start()
    {
        mainCamera.GetComponent<CameraController>().SetDragmode(true);

        inputController = inputObject.GetComponent<InputController>();
        glm = gameLevel.GetComponent<GameLevelManager>();

        glm.LoadMap("small2");

        mainCamera.rect = new Rect(0, 0, 1, 1);
        // minimapCamera.rect = new Rect(0.75f, 0.75f, 0.25f, 0.25f);
    }
示例#24
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag.Equals("Coin"))
     {
         if (mAudioSource != null && CoinSound != null)
         {
             mAudioSource.PlayOneShot(CoinSound);
         }
         GameLevelManager.addScore(10);
         Destroy(other.gameObject);
     }
 }
示例#25
0
        private void Start()
        {
            if (_client == null)
            {
                _client = new Client();
            }

            isResting = false;

            restAreas         = GameObject.FindGameObjectsWithTag("StayArea").ToList();
            _navMeshAgent     = GetComponent <NavMeshAgent>();
            _gameLevelManager = FindObjectOfType <GameLevelManager>().GetComponent <GameLevelManager>();
        }
示例#26
0
文件: Shoot.cs 项目: nova666/I-HERO
 // Update is called once per frame
 void Update()
 {
     if (GameLevelManager.GetSceneName() == "World1_1")
     {
         ControlShootHelper();
     }
     if (Input.GetButtonDown("Fire1"))
     {
         VFXManager.SpawnShootVRX(shootRot);
         SoundManager.PlaySFX("Shoot", shootRot.transform);
     }
     Debug.DrawRay(Camera.main.transform.position, Camera.main.transform.forward * 100, Color.red);
 }
示例#27
0
    private static void ReadLOD()
    {
        int @int = PlayerPrefs.GetInt("QualityOfLODName", 0);
        int num  = @int;

        if (num != 200 && num != 250 && num != 300)
        {
            GameLevelManager.SetGameQuality(GameLevelManager.GameLevelVariable.LODLEVEL, true);
        }
        else
        {
            GameLevelManager.SetGameQuality(@int, true);
        }
    }
示例#28
0
    void Awake()
    {
        instance = this;

        if (LevelSelect.currentDifficulty == LevelDifficulty.Difficulties.Easy)
        {
            Destroy(ball2);
            Destroy(ball3);
        }
        else if (LevelSelect.currentDifficulty == LevelDifficulty.Difficulties.Medium)
        {
            Destroy(ball3);
        }
    }
示例#29
0
        /// <summary>
        /// This function would ensure Level Progression is handled
        /// and game end conditions is handled
        /// </summary>
        public void checkWinningCondition(ref GameLevelManager glm, ref ContentManager content)
        {
            if (this.totalScore > 2)
            {
                // Change Level
                //    if(glm.getCurrentLevel() == 1)
                //        glm = new GameLevelManager(glm.getCurrentLevel() +1, ref content);
            }

            else if (this.totalScore > 14)
            {
                // Change to level 2 and so on so forth ...
            }
        }
示例#30
0
 public static void SetGameQuality(int lod, bool init = false)
 {
     GameLevelManager.GameLevelVariable.LODLEVEL = lod;
     if (!SystemConfig.IsPostProcessOn)
     {
         lod = GameLevelManager.LODLevel.GetDefault();
     }
     GameLevelManager.SetGlobalMaximumLOD(lod);
     GameLevelManager.SetFXMaxParticles(lod);
     GameLevelManager.SetShadow(lod, init);
     GameLevelManager.SetFog(lod);
     GameLevelManager.SetSceneFX(lod, false);
     EventDispatcher.Broadcast(ShaderEffectEvent.LODChanged);
 }
示例#31
0
    void Start()
    {
        AddObjectsToList();

        if (GameLevelManager.GetSceneName() == "boss")
        {
            BossScene     = true;
            PreviousIndex = 0;
        }
        else
        {
            BossScene = false;
        }
    }
示例#32
0
    private void OnTriggerEnter(Collider other)
    {
        CombatScript combatScript = GameObject.Find("EventSystem").GetComponent <CombatScript>();

        if (other.tag == "Hero")
        {
            if (combatScript.getHeroLife() < 5)
            {
                combatScript.addHeroLife(1);
            }
            GameObject.Find("Hero").GetComponent <AudioSource>().PlayOneShot(drink);
            GameLevelManager.addScore(5);
            Destroy(this.gameObject);
        }
    }
示例#33
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Initialize this GamePlayScreen by loading an initial level and all defaults.
        /// </summary>
        /// <param name="gameLevel">Relative path to the GameLevel file to be loaded</param>
        /// <returns>False if init has already been called</returns>
        public virtual bool init(String gameLevel)
        {
            // Check if this GamePlayScreen has already been initialized
            if (_gameLevelMgr != null)
                return false;

            // Load the level passed in
            _gameLevelMgr = new GameLevelManager(_gameContentMgr, _screenMgr.GraphicsDevice);
            _gameLevelMgr.loadLevel("levels\\" + gameLevel);

            // Initialize the user
            initUser();

            return true;
        }
示例#34
0
 void OnTriggerStay(Collider collider)
 {
     if (shouldSearchExit && collider.tag == "Hero")
     {
         AIPath aipath = butterfly.GetComponent <AIPath>();
         aipath.target = exitTarget.transform;
         if (shouldResetSearch)
         {
             GameLevelManager.removeScore(gameLevelManager.getButterflyHelpPoints());
             Invoke("resetSearchExit", 60);
             butterflyText.text = "Siga-me";
             shouldResetSearch  = false;
         }
     }
 }
示例#35
0
    public void StartEditor()
    {
        // editorCamera.GetComponent<CameraController>().SetDragmode(false);

        glm = gameLevel.GetComponent<GameLevelManager>();

        // Set minimap camera
        // minimapCamera.rect = new Rect(0.75f, 0.75f - 0.05f, 0.25f, 0.25f);

        mapTileParent = new GameObject();
        mapTileParent.name = "Map";

        Debug.Log ("Started map editor");

        editorisActive = true;
    }
示例#36
0
    public void removeEnemyLife(int value, GameObject enemy)
    {
        GameLevelManager.addScore(5);
        EnemyLifeScript enemyLifeScript = (EnemyLifeScript )enemy.GetComponent(typeof(EnemyLifeScript));

        enemyLife = enemyLifeScript.removeCurrentLife(value);

        if (enemyLife <= 0)
        {
            enemy.GetComponent <Animator>().SetBool("enemyDied", true);
        }
        else
        {
            enemy.GetComponent <Animator>().SetTrigger(Animator.StringToHash("Hurt"));
        }
    }
示例#37
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Initialize this GameEditorScreen.
        /// </summary>
        /// <returns>False if failed</returns>
        public override bool init()
        {
            _gameLevelMgr       = new GameLevelManager(_gameContentMgr, _screenMgr.GraphicsDevice);
            Tool                = EditorTool.TOOL_NONE;
            _selection          = new List<GameTile>();
            _grabbingSelection  = false;
            _colorSelect        = new Color(0.5f, 1.0f, 0.25f, 0.75f);
            _colorDeselect      = Color.White;

            _elevating          = false;
            _snapping           = false;

            return base.init();
        }