Exemple #1
0
    // Use this for initialization
    void Start()
    {
        loadingPanel = new LoadingPanel();

        loadingPanel.Show();


        startTime = Time.time;



        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        //m_UIManager.SetUIHandler(this);

        m_UIManager.CLEAR = true;

        Transform audioFolderTrans = transform.Find("Audio");

        audioPlayer.AddAudio(audioFolderTrans, "Button");
        audioPlayer.AddAudio(audioFolderTrans, "Battle");
        GameApp.GetInstance().GetGameState().Achievement.SubmitAllToGameCenter();
        if (!GameApp.GetInstance().GetGameState().FromShopMenu)
        {
            m_UIManager.Add(loadingPanel);
        }
        StartCoroutine("Init");
    }
Exemple #2
0
        // Use this for initialization
        public virtual void Init(GameObject gObject)
        {
            gameScene      = GameApp.GetInstance().GetGameScene();
            player         = gameScene.GetPlayer();
            enemyObject    = gObject;
            enemyTransform = enemyObject.transform;
            animation      = enemyObject.GetComponent <UnityEngine.Animation>();
            aimedTransform = enemyTransform.Find(BoneName.ENEMY_AIMED_PATH);
            rigidbody      = enemyObject.GetComponent <Rigidbody>();
            //collider = enemyObject.transform.Find(BoneName.ENEMY_BODY).collider;
            collider = enemyObject.transform.GetComponent <Collider>();
            //sceneGUI = GameObject.Find("SceneGUI").GetComponent<SceneGUI>();
            rConfig = GameApp.GetInstance().GetResourceConfig();


            gConfig          = GameApp.GetInstance().GetGameConfig();
            controller       = enemyObject.GetComponent <Collider>() as CharacterController;
            detectionRange   = 150.0f;
            attackRange      = 1.5f;
            minRange         = 1.5f;
            lootCash         = 0;
            criticalAttacked = false;
            spawnCenter      = enemyTransform.position;

            target = GameObject.Find("Player").transform;

            //rigidbody.centerOfMass = Vector3.up;

            audio = new AudioPlayer();
            Transform audioFolderTrans = enemyTransform.Find("Audio");

            audio.AddAudio(audioFolderTrans, "Attack");
            audio.AddAudio(audioFolderTrans, "Walk");
            audio.AddAudio(audioFolderTrans, "Dead");
            audio.AddAudio(audioFolderTrans, "Special");
            audio.AddAudio(audioFolderTrans, "Shout");

            hitBloodObjectPool = GameApp.GetInstance().GetGameScene().HitBloodObjectPool;

            pathFinding = new GraphPathFinding();

            animation.wrapMode = WrapMode.Loop;
            animation.Play(AnimationName.ENEMY_IDLE);

            state = IDLE_STATE;

            lastUpdateTime      = Time.time;
            lastPathFindingTime = Time.time;

            idleStartTime = -2;
            enemyObject.GetComponent <UnityEngine.Animation>()[AnimationName.ENEMY_ATTACK].wrapMode = WrapMode.ClampForever;

            path = GameApp.GetInstance().GetGameScene().GetPath();
        }
 void Start()
 {
     Telefoon = GetComponent <Button>();
     Telefoon.interactable = false;
     ButtonPresbaar        = false;
     if (sound != null)
     {
         sound.AddAudio("telephone", true, true, 1f, sound.FindClip("knightrider"));
     }
 }
Exemple #4
0
    IEnumerator Init()
    {
        yield return(1);

        UIResourceMgr.GetInstance().LoadAllUIMaterials();
        //if (GameApp.GetInstance().GetGameState().FirstTimeGame)
        {
            if (Time.time - startTime < 1.5f)
            {
                yield return(new WaitForSeconds(1.5f - (Time.time - startTime)));
            }
        }

        GameApp.GetInstance().ClearScene();

        //uiPos = new ArenaMenuUIPosition();
        //texPos = new ArenaMenuTexturePosition();



        panels[MenuName.ARENA] = new ArenaMenuPanel();
        //panels[MenuName.OPTIONS] = new OptionsMenuUI();
        panels[MenuName.UPGRADE]   = new WeaponUpgradeUI();
        panels[MenuName.EQUIPMENT] = new EquipmentUI();
        panels[MenuName.AVATAR]    = new AvatarUI();
        panels[MenuName.SHOP]      = new ShopUI();
        for (int i = 0; i < MenuName.MENU_COUNT; i++)
        {
            m_UIManager.Add(panels[i]);
        }

        panels[MenuName.ARENA].Show();

        Transform audioFolderTrans = transform.Find("Audio");

        audioPlayer.AddAudio(audioFolderTrans, "Button");
        audioPlayer.AddAudio(audioFolderTrans, "Upgrade");
        audioPlayer.AddAudio(audioFolderTrans, "Battle");
        GameApp.GetInstance().GetGameState().Achievement.SubmitAllToGameCenter();
    }
Exemple #5
0
        public void Init()
        {
            //! 随机出生点
            GameObject[] pss = GameObject.FindGameObjectsWithTag("Respawn");
            int          rnd = Random.Range(0, pss.Length);

            GameObject ps = pss[rnd];

            respawnTrans = ps.transform;
            avatarType   = GameApp.GetInstance().GetGameState().Avatar;
            //! playerObject = AvatarFactory.GetInstance().CreateAvatar(avatarType);   //! 创建角色

            playerObject = AvatarFactory.GetInstance().CreateAvatar(Zombie3D.AvatarType.EnegyArmor);               //! 创建钢铁侠
            playerObject.transform.position = ps.transform.position;
            playerObject.transform.rotation = ps.transform.rotation;

            playerObject.name = "Player";
            playerTransform   = playerObject.transform;
            playerConfig      = GameApp.GetInstance().GetGameConfig().playerConf;
            int armorLevel = GameApp.GetInstance().GetGameState().ArmorLevel;

            hp    = playerConfig.hp * (1 + armorLevel * 0.5f);
            maxHp = hp;

            //! 特种兵的血量 × 2
            if (avatarType == AvatarType.Swat)
            {
                hp    = hp * Constant.SWAT_HP;
                maxHp = hp;
            }
            else if (avatarType == AvatarType.EnegyArmor)
            {
                hp    = hp * Constant.ENEGY_ARMOR_HP_BOOST;
                maxHp = hp;
            }


            gameCamera     = GameApp.GetInstance().GetGameScene().GetCamera();
            charController = playerObject.GetComponent <CharacterController>();   //! 控制器
            animation      = playerObject.GetComponent <UnityEngine.Animation>(); //! 动画器
            collider       = playerObject.GetComponent <Collider>();              //! 碰撞检测

            //! 音效
            audioPlayer = new AudioPlayer();
            Transform folderTrans = playerTransform.Find("Audio");

            audioPlayer.AddAudio(folderTrans, AudioName.GETITEM);
            audioPlayer.AddAudio(folderTrans, AudioName.DEAD);
            audioPlayer.AddAudio(folderTrans, AudioName.SWITCH);
            audioPlayer.AddAudio(folderTrans, AudioName.WALK);


            //! 为什么又初始化一边武器列表
            GameApp.GetInstance().GetGameState().InitWeapons();


            weaponList = GameApp.GetInstance().GetGameState().GetBattleWeapons();


            playerState = Player.IDLE_STATE;



            foreach (Weapon w in weaponList)
            {
                w.Init();
            }


            Weapon powerWeapon = null;
            float  maxDamage   = 0;

            foreach (Weapon w in weaponList)
            {
                if (maxDamage < w.Damage)
                {
                    maxDamage   = w.Damage;
                    powerWeapon = w;
                }

                //! if (w.IsSelectedForBattle)
                //! {
                //!     ChangeWeapon(w);
                //!     break;
                //! }
            }

            //! 切换武器
            ChangeWeapon(powerWeapon);


            walkSpeed = GameApp.GetInstance().GetGameConfig().playerConf.walkSpeed - weapon.GetSpeedDrag();  //! 人物速度 - 武器武器负重

            ChangeToNormalState();


            if (gameCamera.GetCameraType() == CameraType.TPSCamera)
            {
                inputController = new TPSInputController();
                inputController.Init();
            }
            else if (gameCamera.GetCameraType() == CameraType.TopWatchingCamera)
            {
                inputController = new TopWatchingInputController();
                inputController.Init();
            }


            UpdateNearestWayPoint();
        }