Exemplo n.º 1
0
 void Initialization()
 {
     _line_Rotation        = new Quaternion(0.7f, 0, 0, 0.7f);
     transform.eulerAngles = Vector3.left * 90;
     _distance             = 5;
     _bomb_Effect          = (GameObject)StaticParameter.LoadObject("GameEffect", "bomb");
 }
Exemplo n.º 2
0
    public void OnEnter()
    {
        //播放音效
        MyAudio.PlayAudio(StaticParameter.s_Sheld, false, StaticParameter.s_Sheld_Volume);
        //加载并实例化护盾模型
        GameObject protect_Mobel = (GameObject)StaticParameter.LoadObject("Other", "Protect");

        _copy          = Object.Instantiate(protect_Mobel);
        _copy_Renderer = _copy.transform.GetChild(0).GetComponent <Renderer>();
        _color         = Color.white;
        _time          = new[] { 1.25f, 0.75f, 0.25f, 0.0f };

        GameObject collider = GameObject.FindGameObjectWithTag("ColliderManager");

        if (_nature.HumanManager_Script.CurrentState == HumanState.Run || _nature.HumanManager_Script.CurrentState == HumanState.Revise)
        {
            if (HumanManager.WallMark == WallMark.Left)
            {
                _copy.transform.position = _nature.Human.position + Vector3.right * 0.86f;
            }
            else
            {
                _copy.transform.position = _nature.Human.position + Vector3.left * 0.86f;
            }
        }
        else
        {
            _copy.transform.position = _nature.Human.position + Vector3.up * 0.72f;
        }

        _copy.transform.SetParent(_nature.Human);
    }
Exemplo n.º 3
0
    GameObject _canvas; //游戏界面的画布

    // Use this for initialization
    void Start()
    {
        _my_Camera = Camera.main;
        _text      = (GameObject)StaticParameter.LoadObject("Other", "Text");
        _canvas    = GameObject.FindWithTag("Canvas");
        //判断变量是否为空
        StaticParameter.JudgeNull("_canvas", _canvas);
    }
Exemplo n.º 4
0
    //创建标记实例,设置好第一个标记,撞到第一个标记,就把实例挪到下一个标记的位置
    void CreatMark()
    {
        float      StartPoint = -31.33f;
        float      mark_Y     = StartPoint + 60;
        GameObject instance   = StaticParameter.LoadObject("Other", "EndlessMark") as GameObject;
        GameObject copy       = Instantiate(instance);

        copy.transform.position = instance.transform.position.x * Vector3.right + mark_Y * Vector3.up +
                                  instance.transform.position.z * Vector3.forward;
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        GameObject protect_Broke_Mobel = (GameObject)StaticParameter.LoadObject("Other", "ProtectParticle");

        _particle_GameObject = Instantiate(protect_Broke_Mobel);
        _particle_GameObject.transform.position = HumanManager.Nature.Human_Mesh.bounds.center;

        _color     = Color.white * 0.3f;
        _direction = new Vector3[transform.childCount];

        for (int i = 0; i < transform.childCount; i++)
        {
            transform.GetChild(i).GetComponent <MeshFilter>().mesh.RecalculateNormals();
            _direction[i] = transform.GetChild(i).GetComponent <MeshFilter>().mesh.normals[0] * Random.Range(0.3f, 0.8f);
        }
    }
Exemplo n.º 6
0
    void Dash(Collider other)    //冲锋
    {
        switch (other.gameObject.layer)
        {
        case MyTags.Fruit_Layer:
            FruitScript fruit = other.transform.GetComponent <FruitScript> ();
            fruit.CutFruit();
            break;

        case MyTags.Obstacle_Layer:
            //播放音效
            MyAudio.PlayAudio(StaticParameter.s_Obstacle_Break, false, StaticParameter.s_Obstacle_Break_Volume);
            //Destroy (other.gameObject);
            try
            {
                StaticParameter.DestroyOrDespawn(other.transform);
                GameObject _obstacle = (GameObject)StaticParameter.LoadObject("Other", "BrokenObstacle");
                GameObject copy      = Instantiate(_obstacle, other.transform.position, Quaternion.identity) as GameObject;
                Destroy(copy, 2);

                SkinnedMeshRenderer huamnRenderer = other.transform.GetComponent <SkinnedMeshRenderer>();
                huamnRenderer.material.DOFade(0, 1);
            }
            catch (Exception)
            {
            }

            //摄像机震动
            CameraShake.Is_Shake_Camera = true;

            break;

        case MyTags.Spring_Layer:
            //播放音效
            MyAudio.PlayAudio(StaticParameter.s_Obstacle_Break, false, StaticParameter.s_Obstacle_Break_Volume);
            //摄像机震动
            CameraShake.Is_Shake_Camera = true;
            //播放破坏动画
            Animator ani = other.transform.GetComponent <Animator>();
            ani.SetBool(StaticParameter.Ani_Key_Broke, true);
            //摄像机震动
            CameraShake.Is_Shake_Camera = true;

            break;
        }
    }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        _default_Material = transform.GetComponent <MeshRenderer>().material;

        //for temp(O' 170224)
        if (transform.parent.name.IndexOf("shoulijian") != -1)
        {
            transform.parent.Rotate(180, 0, 0, Space.World);
            transform.parent.localScale = Vector3.one;
        }
        //从resources文件夹读取资源
        _double_Material = (Material)StaticParameter.LoadObject("Materials", "Golden");

        //判断人物自身技能(这里只判断人物双倍分数技能)
        JudgeSkill(HumanManager.Nature, _double_Material);

        _fly_Speed = 15.0f;

        _rotate_Bool = true;
    }
Exemplo n.º 8
0
    void Start()
    {
        _default_Position      = transform.localPosition;
        _default_Rotation      = transform.localEulerAngles;
        Ice.Is_Jump_Before     = false;
        Ice.IsOnIce            = false;
        WideWallColliderBefore = null;
        _nature = HumanManager.Nature;
        _human  = _nature.Human_Script;
        ItemColliderManager skill_Manager = _human.transform.GetComponentInChildren <ItemColliderManager>();

        StaticParameter.JudgeNull("_human", _human);
        StaticParameter.JudgeNull("skill_Manager", skill_Manager);

        _item_Collider = skill_Manager.gameObject;
        _item_Collider.SetActive(false);

        _effect = (GameObject)StaticParameter.LoadObject("GameEffect", "effect");
        _protect_Broke_Mobel = (GameObject)StaticParameter.LoadObject("Other", "ProtectBroke");
    }
Exemplo n.º 9
0
    public void OnEnter()
    {
        _human.eulerAngles = Vector3.up * 180;

        //播放音效
        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            MyAudio.PlayAudio(StaticParameter.s_GuiYuZi_Skill, false, StaticParameter.s_GuiYuZi_Skill_Volume);
            break;

        case MyKeys.CurrentHero.CiShen:
            MyAudio.PlayAudio(StaticParameter.s_CiShen_Skill, false, StaticParameter.s_CiShen_Skill_Volume);
            break;

        case MyKeys.CurrentHero.YuZi:
            MyAudio.PlayAudio(StaticParameter.s_YuZi_Skill, false, StaticParameter.s_YuZi_Skill_Volume);
            break;
        }
        MyAudio.PlayAudio(StaticParameter.s_Dash, false, StaticParameter.s_Dash_Volume);

        MoveToDashPosition(_nature);

        _Ani.SetInteger(StaticParameter.Ani_Key_HumanState, 6);

        //加载并实例化冲刺模型
        GameObject dash_Mobel = (GameObject)StaticParameter.LoadObject("Other", "Dash");
        GameObject temp       = Object.Instantiate(dash_Mobel);

        _dash_Mobel = temp.transform.GetChild(0);
        _dash_BG    = temp.transform.GetChild(1);
        //调整碰撞框大小及位置
        _item_Colloder_Transform = HumanColliderManager.Item_Collider.transform;
        _item_Colloder           = _item_Colloder_Transform.GetComponent <SphereCollider>();
        //_item_Colloder_Transform.localPosition = Vector3.up * (-1.42f);
        _item_Colloder.radius = 3.38f;
        //特效位置位置初始化
        _dash_Mobel.position = _human.position - Vector3.up * 2;
        _dash_BG.position    = Vector3.right * _dash_BG.position.x + Vector3.up * _human.position.y +
                               Vector3.forward * _human.position.z;
    }
Exemplo n.º 10
0
    public static void InitializePool(ObjectPool spawnPool, string folderName, string prefabName,
                                      int preloadAmount, bool limitInstances, bool limitFIFO, int limitAmount,
                                      bool cullDespawned, int cullAbove, int cullDelay, int cullMaxPerPass)
    {
        //加载资源
        Transform temp = ((GameObject)StaticParameter.LoadObject(folderName, prefabName)).transform;

        PrefabPool refabPool = new PrefabPool(temp)
        {
            preloadAmount          = preloadAmount,  //默认初始化两个Prefab
            limitInstances         = limitInstances, //开启限制
            limitFIFO              = limitFIFO,      //关闭无限取Prefab
            limitAmount            = limitAmount,    //限制池子里最大的Prefab数量
            AutoDestroy            = cullDespawned,  //开启自动清理池子
            DestroyExceptTheNumber = cullAbove,      //最终保留
            DestroyEachTime        = cullDelay,      //多久清理一次
            DestroyNumberEverytime = cullMaxPerPass  //每次清理几个
        };

        //初始化内存池
        spawnPool._perPrefabPoolOptions.Add(refabPool);
        spawnPool.CreatePrefabPool(spawnPool._perPrefabPoolOptions[spawnPool._perPrefabPoolOptions.Count - 1]);
    }
Exemplo n.º 11
0
    void Awake()
    {
        GameObject hero = null;

        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            hero = StaticParameter.LoadObject("Ninja", "GuiYuZi") as GameObject;
            break;

        case MyKeys.CurrentHero.CiShen:
            hero = StaticParameter.LoadObject("Ninja", "CiShen") as GameObject;
            break;

        case MyKeys.CurrentHero.YuZi:
            hero = StaticParameter.LoadObject("Ninja", "Yuzi") as GameObject;
            break;

        case MyKeys.CurrentHero.ShouSi:
            hero = StaticParameter.LoadObject("Ninja", "Shousi") as GameObject;
            break;
        }

        Instantiate(hero);
        //if (SceneManager.GetActiveScene().name.Contains("Endless"))
        //{
        //    copy.transform.position = new Vector3(-4.2f, -25.3f, 1.06f);
        //}

        //初始化人物属性对象
        _nature = new GameResource.HumanNature(1);

        //初始化行为数据
        _state_Data = new BehaviourData();
        _item_Data  = new ItemColliction();
    }
Exemplo n.º 12
0
    void OnTriggerEnter(Collider other)
    {
        if (HumanManager.Nature.HumanManager_Script.CurrentState == HumanState.Dead)
        {
            return;
        }
        if (WideWallColliderBefore == other)
        {
            return;
        }

        ChangeItem(other, _nature.HumanManager_Script, _effect);

        //判断碰撞的物体
        switch (other.gameObject.layer)
        {
        case MyTags.Wide_Wall_Collider_Layer:
            WideWallColliderBefore = other;

            if (Judge(HumanManager.WallMark, other.transform))
            {
                _nature.HumanManager_Script.Collde = other.transform;
            }
            break;

        case MyTags.Toturial_Layer:
        case MyTags.Chest_Layer:
        case MyTags.Fruit_Layer:
            _nature.HumanManager_Script.Collde = other.transform;
            break;

        case MyTags.Spring_Layer:
            if (Judge(HumanManager.WallMark, other.transform))
            {
                _nature.HumanManager_Script.Collde = other.transform;
            }
            break;

        case MyTags.Obstacle_Layer:
        case MyTags.Missile_Layer:
        case MyTags.Sword_Layer:
            if (other.gameObject.layer == MyTags.Missile_Layer)
            {
                Destroy(other.gameObject);
            }

            StartCoroutine(CloseAndResetCollider(other));

            if (ItemColliction.SuperMan.IsRun() || ItemColliction.Dash.IsRun() || ItemColliction.StartDash.IsRun())
            {
                //无敌碰撞的声音
                if (ItemColliction.SuperMan.IsRun() && other.gameObject.layer == MyTags.Obstacle_Layer)
                {
                    MyAudio.PlayAudio(StaticParameter.s_Obstacle_Break, false, StaticParameter.s_Obstacle_Break_Volume);
                }
                //摄像机震动
                CameraShake.Is_Shake_Camera = true;
                if (other.gameObject.layer == MyTags.Missile_Layer)
                {
                    StaticParameter.DestroyOrDespawn(other.transform);
                }
                else
                {
                    //Destroy(other.gameObject);
                    StaticParameter.DestroyOrDespawn(other.transform);
                    GameObject _obstacle = (GameObject)StaticParameter.LoadObject("Other", "BrokenObstacle");
                    GameObject copy      = Instantiate(_obstacle, other.transform.position, Quaternion.identity) as GameObject;
                    Destroy(copy, 2);
                }
            }
            else if (ItemColliction.Protect.IsRun())
            {
                //播放音效
                MyAudio.PlayAudio(StaticParameter.s_Sheld_Break, false, StaticParameter.s_Sheld_Break_Volume);

                ItemColliction.Protect.Exit();
                //摄像机震动
                CameraShake.Is_Shake_Camera = true;
                //护盾破碎
                ProtectBroke();
            }
            else
            {
                _nature.HumanManager_Script.Collde = other.transform;
            }
            break;
        }
    }
Exemplo n.º 13
0
    void OnWizardCreate()
    {
        //GameObject[] ObstacleManagers = GameObject.FindGameObjectsWithTag("ObstacleManager");

        //foreach (GameObject child in ObstacleManagers)
        //{
        //    foreach (Transform transform in child.transform)
        //    {

        //        //修正障碍
        //        if (transform.gameObject.layer == MyTags.Obstacle_Layer)
        //        {
        //            if (transform.position.x < 0)
        //            {
        //                transform.tag = MyTags.Left_Tag;
        //                transform.localScale = Vector3.one * 10;
        //                transform.localEulerAngles = new Vector3(90, 180, -180);
        //                transform.position = new Vector3(-2.3f, transform.position.y, transform.position.z);
        //            }
        //            else if (transform.position.x > 0)
        //            {
        //                transform.tag = MyTags.Right_Tag;
        //                transform.localScale = Vector3.one * 10;
        //                transform.localEulerAngles = new Vector3(-90, 180, 0);
        //                transform.position = new Vector3(2.4f, transform.position.y, transform.position.z);
        //            }
        //            else
        //            {
        //                Debug.Log("没有标签");
        //            }
        //        }
        //        //修正移动障碍
        //        if (transform.gameObject.layer == MyTags.Sword_Layer)
        //        {
        //            if (transform.tag == MyTags.Left_Tag)
        //            {
        //                transform.localScale = Vector3.one;
        //                transform.localEulerAngles = Vector3.zero;
        //                transform.position = new Vector3(-4.3f, transform.position.y, transform.position.z);
        //            }
        //            else if (transform.tag == MyTags.Right_Tag)
        //            {
        //                transform.localScale = Vector3.one;
        //                transform.localEulerAngles = new Vector3(0, 180, 0);
        //                transform.position = new Vector3(4.3f, transform.position.y, transform.position.z);
        //            }
        //            else
        //            {
        //                Debug.Log("没有标签");
        //            }
        //        }

        //    }
        //}

        GameObject[] fruitManagers = GameObject.FindGameObjectsWithTag("FruitManager");
        GameObject   shoulijian    = StaticParameter.LoadObject("Prefab/New", "shoulijian") as GameObject;

        foreach (GameObject i in fruitManagers)
        {
            foreach (Transform tr in i.transform)
            {
                GameObject temp = Instantiate(shoulijian);
                temp.transform.position = tr.position;
                temp.transform.parent   = tr.parent;
            }
        }
    }
Exemplo n.º 14
0
    public void OnEnter()
    {
        if (ItemColliction.Dash.IsRun() ||
            ItemColliction.StartDash.IsRun())
        {
            _nature.HumanManager_Script.CurrentState = _nature.HumanManager_Script.BeforeTheState;
            return;
        }
        if (ItemColliction.DeadDash.IsRun())
        {
            return;
        }
        //统计死亡步数
        StatisticsSteps();

        //播放音效
        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            MyAudio.PlayAudio(StaticParameter.s_GuiYuZi_Dead, false, StaticParameter.s_GuiYuZi_Dead_Volume);
            break;

        case MyKeys.CurrentHero.CiShen:
            MyAudio.PlayAudio(StaticParameter.s_CiShen_Dead, false, StaticParameter.s_CiShen_Dead_Volume);
            break;

        case MyKeys.CurrentHero.YuZi:
            MyAudio.PlayAudio(StaticParameter.s_YuZi_Dead, false, StaticParameter.s_YuZi_Dead_Volume);
            break;
        }
        MyAudio.PlayAudio(StaticParameter.s_Damage, false, StaticParameter.s_Damage_Volume);

        //判断是否购买死亡冲刺
        if (ItemColliction.DeadDash.IsBuy() && !ItemColliction.DeadDash.IsRun())
        {
            HumanManager.Nature.HumanManager_Script.ItemState = ItemState.DeadDash;
        }
        else
        {
            HumanManager.Nature.ColliderManager.SetActive(false);

            //判断碰撞物体,选择死亡方式
            if (HumanManager.Nature.HumanManager_Script.CurrentCollide != null &&
                HumanManager.Nature.HumanManager_Script.CurrentCollide.gameObject.layer == MyTags.Sword_Layer)
            {
                _human.gameObject.SetActive(false);
                MyAudio.PlayAudio(StaticParameter.s_Sword_Death, false, StaticParameter.s_Sword_Death_Volume);
                GameObject hero = null;
                switch (MyKeys.CurrentSelectedHero)
                {
                case MyKeys.CurrentHero.GuiYuZi:
                    hero = StaticParameter.LoadObject("Ninja", "GuiYuZiDead") as GameObject;
                    break;

                case MyKeys.CurrentHero.CiShen:
                    hero = StaticParameter.LoadObject("Ninja", "CiShenDead") as GameObject;
                    break;

                case MyKeys.CurrentHero.YuZi:
                    hero = StaticParameter.LoadObject("Ninja", "YuZiDead") as GameObject;
                    break;

                case MyKeys.CurrentHero.ShouSi:
                    hero = StaticParameter.LoadObject("Ninja", "ShouSiDead") as GameObject;
                    break;
                }

                GameObject copy = Object.Instantiate(hero);
                copy.transform.position    = _human.position;
                copy.transform.eulerAngles = Vector3.left * 90 + Vector3.down * 90;
            }
            else
            {
                _ani.SetInteger(StaticParameter.Ani_Key_HumanState, 4);
            }
            //死亡后人物掉落的移动
            HumanManager.Nature.HumanManager_Script.StartCoroutine(FallDown(12f, 3f));

            GameUIManager method = Transform.FindObjectOfType <GameUIManager>();

            method.TheClicked(GameUI.GameUI_Resurgence);

            //调整人物角度
            switch (HumanManager.WallMark)
            {
            case WallMark.Left:
                _human.eulerAngles = Vector3.right * 20 + Vector3.up * 90;
                break;

            case WallMark.Right:
                _human.eulerAngles = Vector3.right * 20 + Vector3.up * 270;
                break;
            }
        }
    }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     _monster_Dead = (GameObject)StaticParameter.LoadObject("Other", "MonsterDead");
 }