/// private メソッド ///--------------------------------------------------------------------------- /// 衝突後の移動座標をセット private void setScrapedMovePos(GameActorCollManager collMgr, DemoGame.GeometryLine moveLine) { /// 衝突あり if (collMgr.CheckCollHit()) { /// ソート collMgr.SortCollisionTrg(); GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj(0); GameShapeProduct trgShape = trgObj.GetCollisionShape(moveType, collMgr.TrgContainer.GetEntryShapeId(0)); switch (trgShape.GetShapeType()) { /// 三角形 case GameShapeProduct.TypeId.Triangles: setScrapedMovePosTriangle(collMgr, moveLine, (ShapeTriangles)trgShape); break; /// カプセル case GameShapeProduct.TypeId.Capsule: calCollPointMove.Check(moveLine, trgShape); nextPos = calCollPointMove.MovePos; break; } } }
/// private メソッド ///--------------------------------------------------------------------------- /// 衝突後の移動座標をセット public void setScrapedMovePos(GameActorCollManager collMgr, Vector3 movePos) { /// 衝突あり if (collMgr.CheckCollHit()) { /// ソート collMgr.SortCollisionTrg(); GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj(0); GameShapeProduct trgShape = trgObj.GetCollisionShape(moveType, collMgr.TrgContainer.GetEntryShapeId(0)); switch (trgShape.GetShapeType()) { /// 三角形 case GameShapeProduct.TypeId.Triangles: setScrapedMovePosTriangle(collMgr, movePos, (ShapeTriangles)trgShape); break; } } /// 衝突無し else { nextPos = movePos; ResetGroudParam(); } /// Y軸はマイナスまで行かない if (nextPos.Y < 0.0f) { nextPos.Y = 0.0f; } }
/// private メソッド ///--------------------------------------------------------------------------- /// 衝突後の移動座標をセット private void setScrapedMovePos(GameActorCollManager collMgr, Vector3 movePos) { /// 衝突あり if (collMgr.CheckCollHit()) { /// ソート collMgr.SortCollisionTrg(); GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj(0); GameShapeProduct trgShape = trgObj.GetCollisionShape(moveType, collMgr.TrgContainer.GetEntryShapeId(0)); switch (trgShape.GetShapeType()) { /// 三角形 case GameShapeProduct.TypeId.Triangles: setScrapedMovePosTriangle(collMgr, movePos, (ShapeTriangles)trgShape); break; /// カプセル case GameShapeProduct.TypeId.Capsule: calCollSphMove.Check(moveMoveCap, (ShapeCapsule)trgShape); nextPos = calCollSphMove.MovePos; break; } } /// 衝突無し else { nextPos = movePos; } }
/// チェック public bool Check(GameActorCollManager collMgr, DemoGame.GeometryLine moveMoveLine) { collMgr.StartCollision(); for (int i = 0; i < collMgr.TrgContainer.Num; i++) { GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj(i); for (int x = 0; x < trgObj.GetCollisionShapeMax(moveType); x++) { GameShapeProduct trgShape = trgObj.GetCollisionShape(moveType, x); /// 衝突 if (calCollPointMove.Check(moveMoveLine, trgShape)) { collMgr.SetCollParam(i, x, calCollPointMove.BestId, calCollPointMove.BestDis); } } } /// 衝突座標をセット setScrapedMovePos(collMgr, moveMoveLine); /// 衝突した return(collMgr.CheckCollHit()); }
/// イベントの再生 public void Play(GameActorProduct trgActor, GameActorEventContainer eveCntr) { if (eveCntr.Num > 0) { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); for (int i = 0; i < eveCntr.Num; i++) { GameObjProduct trgObj = eveCntr.GetEntryObj(i); /// ダメージ if (eveCntr.GetEventId(i) == ActorEventId.Damage) { trgActor.SetEventDamage(trgObj, (Data.AttackTypeId)eveCntr.GetEntryAtb(i)); } /// エフェクト再生 else if (eveCntr.GetEventId(i) == ActorEventId.Effect) { if (trgObj != null) { ctrlResMgr.CtrlEffect.EntryEffect((Data.EffTypeId)eveCntr.GetEntryAtb(i), trgObj); } else { ctrlResMgr.CtrlEffect.EntryEffect((Data.EffTypeId)eveCntr.GetEntryAtb(i), eveCntr.GetTrgPos(i)); } } /// 相手の方へ向く else if (eveCntr.GetEventId(i) == ActorEventId.LookTrg) { trgActor.SetLookTrgPos(eveCntr.GetTrgPos(i)); } /// 相手の方へ振り向く else if (eveCntr.GetEventId(i) == ActorEventId.TurnTrg) { if (trgObj != null) { trgActor.SetEventTurnPos(new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42, trgObj.Mtx.M43), eveCntr.GetEntryAtb(i)); } } /// スーパーアーマー化 else if (eveCntr.GetEventId(i) == ActorEventId.SuperArm) { trgActor.SetEventSuperArm(); } /// 動作キャンセル else if (eveCntr.GetEventId(i) == ActorEventId.MvtCancel) { trgActor.SetEventMvtCancel(); } } } eveCntr.Clear(); }
/// 破棄 public override void Term() { DoTerm(); if (moveCollMgr != null) { moveCollMgr.Term(); } if (unitCmnPlay != null) { unitCmnPlay.Term(); } if (EventCntr != null) { EventCntr.Clear(); EventCntr.Term(); } if (interfereCntr != null) { interfereCntr.Term(); } interfereCntr = null; EventCntr = null; moveCollMgr = null; unitCmnPlay = null; dmgTrgObj = null; }
/// 継承メソッド ///--------------------------------------------------------------------------- /// 初期化 public override bool DoInit() { objEff = new ObjEffect(); objEff.Init(); objTrg = null; return true; }
/// 継承メソッド ///--------------------------------------------------------------------------- /// 初期化 public override bool DoInit() { objEff = new ObjEffect(); objEff.Init(); objTrg = null; return(true); }
/// OBJの登録 public bool Add(GameActorProduct parent, GameObjProduct obj) { objParamList.Add(new ActorUnitCollObjParam()); objParamList[(objParamList.Count - 1)].ObjParent = parent; objParamList[(objParamList.Count - 1)].Obj = obj; return(true); }
/// OBJの登録 public bool Add( GameActorProduct parent, GameObjProduct obj ) { objParamList.Add( new ActorUnitCollObjParam() ); objParamList[(objParamList.Count-1)].ObjParent = parent; objParamList[(objParamList.Count-1)].Obj = obj; return true; }
/// 終了 public override void End() { DoEnd(); unitCmnPlay.End(); EventCntr.Clear(); dmgTrgObj = null; Enable = false; }
/// 追従エフェクトの登録 public bool EntryEffect( Data.EffTypeId effId, GameObjProduct trgObj ) { ActorEffAttach actorEff = new ActorEffAttach(); actorEff.Init(); actorEff.Start(); actorEff.SetMdlHandle( effId ); actorEff.SetTrgObj( trgObj ); actorEffList.Add( actorEff ); return true; }
/// イベントの登録 public bool Add( ActorEventId eveId, int eveAtb, GameObjProduct obj ) { /// 登録許容量OVER if( eveParamList.Count >= entryMax ){ return false; } eveParamList.Add( new GameActorEventParam() ); eveParamList[(eveParamList.Count-1)].EventId = eveId; eveParamList[(eveParamList.Count-1)].EventAtb = eveAtb; eveParamList[(eveParamList.Count-1)].TrgObj = obj; return true; }
/// カメラのY軸回転をセット public void SetCamRotY(float rotY) { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42, trgObj.Mtx.M43); worldRot.Y = rotY; /// カメラにセットする行列を登録 /// actorBehind.SetMoveParam(worldMtx, movePos, worldRot, 4.0f, 1); actorBehind.Frame(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); }
/// 追従エフェクトの登録 public bool EntryEffect(Data.EffTypeId effId, GameObjProduct trgObj) { ActorEffAttach actorEff = new ActorEffAttach(); actorEff.Init(); actorEff.Start(); actorEff.SetMdlHandle(effId); actorEff.SetTrgObj(trgObj); actorEffList.Add(actorEff); return(true); }
/// チェック public bool Check(GameActorCollManager collMgr, Vector3 movePos) { ShapeSphere moveSph = (ShapeSphere)collMgr.MoveShape; moveMoveCap.Set(moveSph.Sphre.Pos, movePos, moveSph.Sphre.R); collMgr.StartCollision(); for (int i = 0; i < collMgr.TrgContainer.Num; i++) { GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj(i); for (int x = 0; x < trgObj.GetCollisionShapeMax(moveType); x++) { GameShapeProduct trgShape = trgObj.GetCollisionShape(moveType, x); bool hitFlg = false; switch (trgShape.GetShapeType()) { /// 三角形 case GameShapeProduct.TypeId.Triangles: hitFlg = calCollSphMove.Check(moveMoveCap, (ShapeTriangles)trgShape); break; /// カプセル case GameShapeProduct.TypeId.Capsule: hitFlg = calCollSphMove.Check(moveMoveCap, (ShapeCapsule)trgShape); break; } /// 衝突 if (hitFlg) { collMgr.SetCollParam(i, x, calCollSphMove.BestId, calCollSphMove.BestDis); if (moveType == Data.CollTypeId.ChMove) { trgObj.deadFlag = true; } } } } /// 衝突後の移動座標をセット setScrapedMovePos(collMgr, movePos); /// 衝突した return(collMgr.CheckCollHit()); }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public override void SetEventDamage( GameObjProduct trgObj, Data.AttackTypeId dmgId ) { if( stateIsPlayId != StateId.Dead ){ dmgTrgObj = trgObj; hpNow --; if( hpNow <= 0 ){ ChangeState( StateId.Dead ); } else { ChangeState( StateId.Damage ); } } }
/// イベントの登録 public bool Add(ActorEventId eveId, int eveAtb, GameObjProduct obj) { /// 登録許容量OVER if (eveParamList.Count >= entryMax) { return(false); } eveParamList.Add(new GameActorEventParam()); eveParamList[(eveParamList.Count - 1)].EventId = eveId; eveParamList[(eveParamList.Count - 1)].EventAtb = eveAtb; eveParamList[(eveParamList.Count - 1)].TrgObj = obj; return(true); }
/// FPSカメラ private bool frameLookSelf() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, worldDis, 10, 20, 0.0f); actorBehind.FrameLookSelf(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public override void SetEventDamage(GameObjProduct trgObj, Data.AttackTypeId dmgId) { if (stateIsPlayId != StateId.Dead) { dmgTrgObj = trgObj; hpNow--; if (hpNow <= 0) { ChangeState(StateId.Dead); } else { ChangeState(StateId.Damage); } } }
/// 開始 public bool Start() { autoCamCnt = 0; autoCamFrame = 0; worldMtx = Matrix4.Identity; worldRot = new Vector3(0.0f, 0.0f, 0.0f); worldDis = 6.0f; modeChangeFlg = false; ResetCamMode(); actorBehind.Start(); GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42, trgObj.Mtx.M43); actorBehind.SetMoveParam(worldMtx, movePos, worldRot, 5.0f, 1); actorBehind.Frame(); return(true); }
/// private メソッド ///--------------------------------------------------------------------------- /// 通常カメラ private bool frameFieldEyecam() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); worldRot.X += AppInput.GetInstance().CamRotX; worldRot.Y += AppInput.GetInstance().CamRotY; if (worldRot.Y > 360.0f) { worldRot.Y -= 360.0f; } else if (worldRot.Y < -360.0f) { worldRot.Y += 360.0f; } if (worldRot.X > 40.0f) { worldRot.X = 40.0f; } else if (worldRot.X < -40.0f) { worldRot.X = -40.0f; } worldDis = 6.0f; GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, worldDis, 10, 20, 1); actorBehind.FrameLookSelf(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// フレーム処理(リザルト用) public bool FrameResult() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); worldRot.X += AppInput.GetInstance().CamRotX; worldRot.Y += AppInput.GetInstance().CamRotY; if (worldRot.Y > 360.0f) { worldRot.Y -= 360.0f; } else if (worldRot.Y < -360.0f) { worldRot.Y += 360.0f; } if (worldRot.X > 30.0f) { worldRot.X = 30.0f; } else if (worldRot.X < 0.0f) { worldRot.X = 0.0f; } GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, 5.0f, 4); actorBehind.Frame(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
public void Clear() { TrgObj = null; }
/// 通常カメラ private bool frameChangeCam() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); if (camModeId == ModeId.CloseLookToNormal || camModeId == ModeId.NormalToCloseLook) { if (camModeId == ModeId.NormalToCloseLook) { changeCount++; worldRot.X = (-60.0f * changeCount + changeRot.X * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; } else if (camModeId == ModeId.CloseLookToNormal) { changeCount--; worldRot.X = (changeRot.X * changeCount - 10.0f * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; } worldDis = (20.0f * changeCount + 6.0f * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; if (changeCount > (int)Data.SetupValue.ChangeCamSpeed) { SetCamMode(ModeId.CloseLook); } else if (changeCount < 0) { SetCamMode(ModeId.Normal); } cammovespeed = 5; lookrate = 1.0f; } else if (camModeId == ModeId.LookMyselfToNormal || camModeId == ModeId.NormalToLookMyself) { if (camModeId == ModeId.NormalToLookMyself) { changeCount++; worldRot.X = (-45.0f * changeCount + changeRot.X * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; float lookY = preLook.Y + 25.0f; if (lookY > 360.0f) { lookY -= 360.0f; } else if (lookY < -360.0f) { lookY += 360.0f; } worldRot.Y = (lookY * changeCount + changeRot.Y * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; } else if (camModeId == ModeId.LookMyselfToNormal) { changeCount--; worldRot.X = (changeRot.X * changeCount + preLook.X * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; worldRot.Y = (changeRot.Y * changeCount + preLook.Y * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; } worldDis = (50.0f * changeCount + 6.0f * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; lookrate = (0.0f * changeCount + 1.0f * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; camBehindY = (15.0f * changeCount + 20.0f * ((int)Data.SetupValue.ChangeCamSpeed - changeCount)) / (int)Data.SetupValue.ChangeCamSpeed; cammovespeed = 20; if (changeCount > (int)Data.SetupValue.ChangeCamSpeed) { SetCamMode(ModeId.LookMyself); } else if (changeCount < 0) { SetCamMode(ModeId.Normal); } } GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, worldDis, cammovespeed, moveDisX, lookrate); actorBehind.FrameLookSelf(); // actorBehind.Frame(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// 破棄 public override void Term() { DoTerm(); if( moveCollMgr != null ){ moveCollMgr.Term(); } if( unitCmnPlay != null ){ unitCmnPlay.Term(); } if( EventCntr != null ){ EventCntr.Clear(); EventCntr.Term(); } if( interfereCntr != null ){ interfereCntr.Term(); } interfereCntr = null; EventCntr = null; moveCollMgr = null; unitCmnPlay = null; dmgTrgObj = null; }
/// 終了 public override void DoEnd() { objTrg = null; objEff.End(); }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public override void SetEventDamage(GameObjProduct trgObj, Data.AttackTypeId dmgId) { brokenFlg = true; }
/// 追従対象のOBJをセット public void SetTrgObj(GameObjProduct trgObj) { objTrg = trgObj; }
public void Clear() { Obj = null; ObjParent = null; CollFlg = false; }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public virtual void SetEventDamage( GameObjProduct trgObj, Data.AttackTypeId dmgId ) { }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public override void SetEventDamage( GameObjProduct trgObj, Data.AttackTypeId dmgId ) { brokenFlg = true; }
/// アクタイベント ///--------------------------------------------------------------------------- /// ダメージ public virtual void SetEventDamage(GameObjProduct trgObj, Data.AttackTypeId dmgId) { }
/// 追従対象のOBJをセット public void SetTrgObj( GameObjProduct trgObj ) { objTrg = trgObj; }