public void Initialize(EnemyInitData initData) { this.initData = initData; ani = GetComponent <Animator>(); targetCollider = GetComponent <Collider>(); rigidbodyList = GetComponentsInChildren <Rigidbody>(); { var meshRendererList = GetComponentsInChildren <MeshRenderer>(); foreach (var renderer in meshRendererList) { foreach (var mat in renderer.materials) { if (mat != null) { materialList.Add(mat); } } } } { var meshRendererList = GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (var renderer in meshRendererList) { foreach (var mat in renderer.materials) { if (mat != null) { materialList.Add(mat); } } } } foreach (var mat in materialList) { mat.SetColor(burnningColorId, burnningColorValue); } burnningLight.gameObject.SetActive(false); ToggleRagdoll(true); }
public override void OnInitializeScene(ISceneInitData _initData) { initData = (GameSceneInitData)_initData; GameInstance.Inst.PlayBGM(new BgmEnum[] { BgmEnum.Game, BgmEnum.GameAmbient }); field = GenericPrefab.InstantiatePathFormat <Field>(initData.FieldId.ToString()); cameraTrack = field.GetCameraTrack(); heliPlayer = GenericPrefab.Instantiate <HeliPlayer>(cameraTrack.GetCameraJoint()); subStageList = field.GetSubStageList(); //GameSceneState { int enemyCount = 0; var fistStage = subStageList.FirstOrDefault(); Transform firstTarget = null; if (fistStage != null) { var firstEnemy = fistStage.EnemyList.FirstOrDefault(); enemyCount = fistStage.EnemyList.Count; if (firstEnemy != null) { firstTarget = firstEnemy.TargetJoint; } } gameSceneState = new GameSceneState() { TargetEnemyList = fistStage.EnemyList.ToList(), HeliPlayerData = new HeliPlayerData() { Zoom = false, Target = firstTarget }, SubStageId = fistStage.SubStageId, NextSubStageId = fistStage.NextSubStageId, LeftEnemyCount = enemyCount, CurrentEnemyIndex = 0 }; fistStage.SetColliderActive(true); gameSceneState.InvalidTarget(); heliPlayer.ApplyHeliPlayerData(gameSceneState.HeliPlayerData); view.ApplyGameSceneState(gameSceneState); } //init enemy { var enemyInitData = new EnemyInitData() { OnKillEnemy = OnKillEnemy, OnRemoveEnemy = OnRemoveEnemy }; foreach (var subStage in subStageList) { foreach (var enemy in subStage.EnemyList) { enemy.Initialize(enemyInitData); } } } //Init CameraTrack cameraTrack.SetSubStage(1); startTime = Time.time; view.ApplyTime(Time.time - startTime); }