// Token: 0x06000779 RID: 1913 RVA: 0x00006C21 File Offset: 0x00004E21
 public SpectatorState(LevelCamera camera, Vector3 offset) : base(camera, offset)
 {
     this._targetPosition = camera.Transform.position;
 }
 // Token: 0x06000772 RID: 1906 RVA: 0x00006BE2 File Offset: 0x00004DE2
 public SmoothFollowState(LevelCamera camera, Vector3 offset) : base(camera, offset)
 {
     this._collideDistance = this._distance / 2f;
     camera.InitUserInput();
 }
 // Token: 0x06000777 RID: 1911 RVA: 0x00033D5C File Offset: 0x00031F5C
 public RagdollState(LevelCamera camera, Vector3 offset) : base(camera, offset)
 {
     this.targetPosition = GameState.Current.Avatar.Ragdoll.GetBone(BoneIndex.Hips).position + new Vector3(0f, 1.5f, 0f);
 }
 // Token: 0x06000766 RID: 1894 RVA: 0x00006B40 File Offset: 0x00004D40
 protected CameraState(LevelCamera camera, Vector3 offset)
 {
     this.camera = camera;
     this.offset = offset;
 }
 // Token: 0x0600076B RID: 1899 RVA: 0x00006B56 File Offset: 0x00004D56
 public DisabledState(LevelCamera camera, Vector3 offset) : base(camera, offset)
 {
 }
示例#6
0
 void Start()
 {
     cam = LevelCamera.GetComponent <LevelCamera>();
 }
示例#7
0
    void DoSpawn(Vector3 P, Vector3 dir)
    {
        Vector3 vector;

        if (this._spawnOnFloor && PhysicsUtility.GetFloorPoint(P, 20f, 50f, this._floorLayer, out vector))
        {
            P.y = vector.y;
        }
        Vector3    vector2    = P + this._playerEnt.transform.localPosition;
        GameObject gameObject = Object.Instantiate <GameObject>(this._playerCamera, vector2 + this._playerCamera.transform.localPosition, this._playerCamera.transform.localRotation);

        gameObject.transform.localScale = this._playerCamera.transform.localScale;
        gameObject.name = this._playerCamera.name;
        CameraContainer component = gameObject.GetComponent <CameraContainer>();

        component.Init(this._playerCamera);
        Entity entity = Object.Instantiate <Entity>(this._playerEnt, vector2, base.transform.rotation);

        entity.name = this._playerEnt.name;
        if (component != null)
        {
            RoomSwitchable componentInChildren = entity.GetComponentInChildren <RoomSwitchable>();
            if (componentInChildren != null)
            {
                componentInChildren.SetLevelCamera(component);
            }
        }
        if (this._playerGraphics != null)
        {
            GameObject gameObject2 = Object.Instantiate <GameObject>(this._playerGraphics, entity.transform.position + this._playerGraphics.transform.localPosition, this._playerGraphics.transform.localRotation);
            gameObject2.transform.parent     = entity.transform;
            gameObject2.transform.localScale = this._playerGraphics.transform.localScale;
            gameObject2.name = this._playerGraphics.name;
        }
        entity.Init();
        entity.TurnTo(dir, 0f);
        FollowTransform componentInChildren2 = gameObject.GetComponentInChildren <FollowTransform>();

        if (componentInChildren2 != null)
        {
            componentInChildren2.SetTarget(entity.transform);
        }
        LevelCamera componentInChildren3 = gameObject.GetComponentInChildren <LevelCamera>();

        if (componentInChildren3 != null)
        {
            LevelRoom roomForPosition = LevelRoom.GetRoomForPosition(entity.WorldTracePosition, null);
            if (roomForPosition != null)
            {
                componentInChildren3.SetRoom(roomForPosition);
                roomForPosition.SetImportantPoint(vector2);
                LevelRoom.SetCurrentActiveRoom(roomForPosition, false);
            }
        }
        PlayerController controller = ControllerFactory.Instance.GetController <PlayerController>(this._controller);

        controller.ControlEntity(entity);
        controller.name = this._controller.name;
        entity.Activate();
        if (this._varOverrider != null)
        {
            this._varOverrider.Apply(entity);
        }
        EntityHUD componentInChildren4 = gameObject.GetComponentInChildren <EntityHUD>();

        if (componentInChildren4 != null)
        {
            componentInChildren4.Observe(entity, controller);
        }
        EntityObjectAttacher.Attacher attacher   = null;
        EntityObjectAttacher          component2 = base.GetComponent <EntityObjectAttacher>();

        if (component2 != null)
        {
            attacher = component2.GetAttacher();
        }
        EntityObjectAttacher.AttachTag attachTag = null;
        if (attacher != null)
        {
            attachTag = attacher.Attach(entity);
        }
        PlayerRespawner playerRespawner;

        if (this._respawner != null)
        {
            playerRespawner      = Object.Instantiate <PlayerRespawner>(this._respawner);
            playerRespawner.name = this._respawner.name;
        }
        else
        {
            GameObject gameObject3 = new GameObject("PlayerRespawer");
            playerRespawner = gameObject3.AddComponent <PlayerRespawner>();
        }
        playerRespawner.Init(entity, controller, componentInChildren3, componentInChildren2, componentInChildren4, this._gameSaver, attacher, attachTag, this._varOverrider, P, dir);
        VarHelper.PlayerObj = entity.gameObject;         // Store reference to player obj
        PlayerSpawner.OnSpawnedFunc onSpawnedFunc = PlayerSpawner.onSpawned;
        PlayerSpawner.onSpawned = null;
        if (onSpawnedFunc != null)
        {
            onSpawnedFunc(entity, gameObject, controller);
        }
        EventListener.PlayerSpawn(false);         // Invoke custom event
        Object.Destroy(base.gameObject);
    }
示例#8
0
 // Token: 0x06000FA9 RID: 4009 RVA: 0x0000B0D8 File Offset: 0x000092D8
 public void AddDamageMark(float normalizedDamage, float horizontalAngle)
 {
     this._damageFeedbackMarkList.Add(new DamageFeedbackHud.DamageFeedbackMark(normalizedDamage, horizontalAngle));
     LevelCamera.DoFeedback(LevelCamera.FeedbackType.GetDamage, Vector3.back, 0.1f, normalizedDamage, 0.04f, 0.08f, 10f, Vector3.forward);
 }
示例#9
0
 // Constructor
 protected void Awake()
 {
     levelCamera = FindObjectOfType<LevelCamera>();
     Assert.IsNotNull(levelCamera);
 }
    //创建资源
    void CreateRes()
    {
        camParam = new CamParam(new Vector3(50, 0, 0), heroCamera.fieldOfView);

        //level resources
        GameObject go = (GameObject)Instantiate(prbLevelRes);
        go.transform.parent = transform;

        //level config
        go = (GameObject)Instantiate(prbLevelConfig, Vector3.zero, Quaternion.identity);
        curConfig = go.GetComponent<LevelConfig>();
        go.transform.parent = transform;

        if (prbLevelCamera)
        {
            //level camera path animation
            go = (GameObject)Instantiate(prbLevelCamera);

            curLevelCamera = go.GetComponent<LevelCamera>();
            go.transform.parent = transform;
        }

        //开始
        StartCoroutine(Init());
        InitRes();
    }
    public IEnumerator Init()
    {
        #region debug
        if (isDebug)
        {
            // record params of camera
            camParam = new CamParam(new Vector3(50, 0, 0), heroCamera.fieldOfView);
            curConfig = GameObject.FindObjectOfType(typeof(LevelConfig)) as LevelConfig;
            curLevelCamera = GameObject.FindObjectOfType(typeof(LevelCamera)) as LevelCamera;

            InitRes();

            if (isDebugPvp)
            {
                flowType = FlowType.PVP;
                LevelData.levelType = 8;
            }
        }
        #endregion

        curConfig.Init();

        while (!isInit) yield return null;

        //my heros init :
        myPlayer.ExternalInit();

        switch (flowType)
        {
            case FlowType.PVP:
                InitPVP();
                break;
            default:
                InitPVE();
                break;
        }

        //顺计时开始
        StartCoroutine(BeginTimer());
        //默认计时显示
        UIBattleManager.instance.LoginCountUpTimer();
        InvokeRepeating("CountUpTimer", 0f, 1f);

        ExecuteAction();

        //Debug.Log(" wait time----------------------" + curLevelCamera.waitTimeToPlay);
        if (curLevelCamera)
        {
            if (curLevelCamera.waitTimeToPlay > 0)
                yield return new WaitForSeconds(curLevelCamera.waitTimeToPlay);

            if (curLevelCamera.open.Count > 0)
            {
                int endIndex = curLevelCamera.open.Count - 1;
                foreach (CameraPathBezierAnimator cpa in curLevelCamera.open)
                {
                    cpa.animationTarget = heroCamera.transform;
                }

                curLevelCamera.open[endIndex].AnimationFinished += CameraFinish;
                curLevelCamera.open[0].Play();
                Debug.Log("Camera Play --------------");
            }
            else CameraFinish();
        }
        else
        {
            Debug.Log("LevelCamera is Null --------------");
            CameraFinish();
        }
    }
    void LoadLevelToScene()
    {
        if (curCP != null)
        {
            curCP.gameObject.SetActive(false);
        }

        LevelCamera lc = GetExistLevel(select.prbLevelCameraPath.name);
        if (lc != null)
        {
            lc.gameObject.SetActive(true);
            curCP = lc;
        }
        else
        {
            GameObject go = KMPrefabEditor.LoadPrefab(select.prbLevelCameraPath, null);
            go.transform.parent = goParent.transform;
            curCP = go.GetComponent<LevelCamera>();
        }

        if (curRes) DestroyImmediate(curRes.gameObject);
        curRes = KMPrefabEditor.LoadPrefab(select.prbMapRes, null);

        targetPrefab = select.prbLevelCameraPath;

        Selection.activeGameObject = curCP.gameObject;

        //save data form last load
        EditorPrefs.SetInt(KEY_LCPDungeonIndex, select.curDungeonIndex);
        EditorPrefs.SetInt(KEY_LCPChapterIndex, select.curChapterIndex);
    }
    void ShowRes()
    {

        if (curCP == null)
        {
            curCP = GameObject.FindObjectOfType(typeof(LevelCamera)) as LevelCamera;
            //set value form  last 
            if (curCP)
            {
                select.curChapterIndex = EditorPrefs.GetInt(KEY_LCPChapterIndex, select.curChapterIndex);
                select.curDungeonIndex = EditorPrefs.GetInt(KEY_LCPDungeonIndex, select.curDungeonIndex);
                //Debug.Log(select.curChapterIndex + "-------------" + select.curDungeonIndex);
            }
        }

        GUILayout.BeginHorizontal();

        string resName = select.prbMapRes ? "Res:" : select.curDungeon.resname;
        GUILayout.Label(resName);

        hasRes = EditorGUILayout.ObjectField("", select.prbMapRes, typeof(Object), false);

        if (!hasRes)
        {
            GUILayout.Label("please import res of map before Edit!");
            return;
        }


        bool hasCameraPath = select.prbLevelCameraPath;

        if (!hasCameraPath)
        {
            if (select.prbModelLevelCamera && GUILayout.Button("Create Camera"))
            {
                CreatePrefab();
            }
        }
        else
        {
            GUILayout.Label("Camera Prefab:");
            EditorGUILayout.ObjectField("", select.prbLevelCameraPath, typeof(Object), false);

            if (curCP != null && curCP.name == select.prbLevelCameraPath.name)
            {
                //if (GUILayout.Button("Edit")) EditLevel();
            }
            if (GUILayout.Button("Show In Scene"))
                LoadLevelToScene();

            //, GUILayout.MinWidth(200f)
            if (GUILayout.Button("ReLoad Json", GUILayout.MaxWidth(100f)))
            {
                ReLoadJson();
            }
        }

        GUILayout.EndHorizontal();

        if (curCP == null) return;

        GUILayout.Space(20);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Save"))
        {
            SaveLevel();
        }

        GUILayout.EndHorizontal();
    }
示例#14
0
    // Constructor
    protected void Awake()
    {
        GameEngine.Player = this;

        Assert.IsNotNull(deathParticlePrefab);
        Assert.IsNotNull(playerTexRend);
        Assert.IsNotNull(playerTexObj);
        Assert.IsTrue(playerMaterials.Count == 17);

        levelCamera = FindObjectOfType<LevelCamera>();
        Assert.IsNotNull(levelCamera);

        movement = gameObject.GetComponent<Movement>();
        Assert.IsNotNull(movement);

        shooting = gameObject.GetComponent<Shooting>();
        Assert.IsNotNull(shooting);

        health = gameObject.GetComponent<Health>();
        Assert.IsNotNull(health);

        col = GetComponent<Collider>();
        Assert.IsNotNull(col);
    }
示例#15
0
 // Constructor
 protected void Awake()
 {
     levelCamera = FindObjectOfType <LevelCamera>();
     Assert.IsNotNull(levelCamera);
 }
示例#16
0
    // Token: 0x06001F9A RID: 8090 RVA: 0x000979E8 File Offset: 0x00095BE8
    private void AddGameLogicToWeapon(WeaponSlot weapon)
    {
        float movement = WeaponConfigurationHelper.GetRecoilMovement(weapon.View);
        float kickback = WeaponConfigurationHelper.GetRecoilKickback(weapon.View);
        global::LoadoutSlotType slot = weapon.Slot;

        if (weapon.Logic is ProjectileWeapon)
        {
            ProjectileWeapon w = weapon.Logic as ProjectileWeapon;
            w.OnProjectileShoot += delegate(ProjectileInfo p)
            {
                ProjectileDetonator projectileDetonator = new ProjectileDetonator(WeaponConfigurationHelper.GetSplashRadius(weapon.View), (float)weapon.View.DamagePerProjectile, weapon.View.DamageKnockback, p.Direction, weapon.SlotId, p.Id, weapon.View.ID, weapon.View.ItemClass, w.Config.DamageEffectFlag, w.Config.DamageEffectValue);
                if (p.Projectile != null)
                {
                    p.Projectile.Detonator = projectileDetonator;
                    if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                    {
                        GameState.Current.Actions.EmitProjectile(p.Position, p.Direction, slot, p.Id, false);
                    }
                }
                else
                {
                    projectileDetonator.Explode(p.Position);
                    if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                    {
                        GameState.Current.Actions.EmitProjectile(p.Position, p.Direction, slot, p.Id, true);
                    }
                }
                if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                {
                    if (w.HasProjectileLimit)
                    {
                        Singleton <ProjectileManager> .Instance.AddLimitedProjectile(p.Projectile, p.Id, w.MaxConcurrentProjectiles);
                    }
                    else
                    {
                        Singleton <ProjectileManager> .Instance.AddProjectile(p.Projectile, p.Id);
                    }
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
        else if (weapon.Logic is MeleeWeapon)
        {
            float delay = weapon.Logic.HitDelay;
            weapon.Logic.OnTargetHit += delegate(CmunePairList <BaseGameProp, ShotPoint> h)
            {
                if (!weapon.View.HasAutomaticFire)
                {
                    GameState.Current.Actions.SingleBulletFire();
                }
                if (h != null)
                {
                    UnityRuntime.StartRoutine(this.StartApplyDamage(weapon, delay, h));
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
        else
        {
            weapon.Logic.OnTargetHit += delegate(CmunePairList <BaseGameProp, ShotPoint> h)
            {
                if (!weapon.View.HasAutomaticFire)
                {
                    GameState.Current.Actions.SingleBulletFire();
                }
                if (h != null)
                {
                    this.ApplyDamage(weapon, h);
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
    }