public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる playerDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3"); bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); state = (C_CharaState)entity.GetNormalComponent("C_CharaState"); state.IsJump = true; animControl = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion"); animControl.SetNowAnim("Jump"); if (playerDirection.IsRight()) { entity.transform.Angle = 330; } else if (playerDirection.IsLeft()) { entity.transform.Angle = 210; } else if (playerDirection.IsNone()) { entity.transform.Angle = 360; } entity.transform.SetPositionY += currentJumpPower; }
public C_DrawDebugMessage(GameDevice gameDevice, C_BezierPoint bezier, float alpha = 1, float depth = 100) { this.alpha = alpha; this.depth = depth; this.bezier = bezier; inputState = gameDevice.GetInputState; }
public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる player = EntityManager.FindWithTag("Player")[0]; childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3"); state = (C_CharaState)entity.GetNormalComponent("C_CharaState"); bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); childState = (C_ChildState)entity.GetNormalComponent("C_ChildState"); energy = (C_Energy)entity.GetNormalComponent("C_Energy"); collider = entity.GetColliderComponent("Squirrel"); draw = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion"); restExpend = energy.GetLimitEnery() / 60 / 50; //50秒で体力尽き moveExpend = energy.GetLimitEnery() / 60 / 20 + restExpend; if (childDirection.IsRight()) { entity.transform.Angle = 360; } else if (childDirection.IsLeft()) { entity.transform.Angle = 180; } else if (childDirection.IsNone()) { entity.transform.Angle = 360; } }
private void CreateSquirrel(Vector2 position) { Transform2D trans = new Transform2D(); trans.Position = position; Entity child = Entity.CreateEntity("Squirrel", "Child", trans); child.RegisterComponent(new C_Switch3()); child.RegisterComponent(new C_CharaState()); child.RegisterComponent(new C_ChildState()); C_BezierPoint bezier = new C_BezierPoint(); child.RegisterComponent(bezier); BezierStage.AddBezierData(bezier); //child.RegisterComponent(new C_DrawDebugMessage(bezier)); child.RegisterComponent(new C_EntityDeadCheck()); child.RegisterComponent(new C_Energy("", 10, 90)); C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(80, 60), 14); drawComp.AddAnim("Run", new AnimData(7, 7, 0.08f, "A_Squirrel_Run")); drawComp.AddAnim("Eat", new AnimData(1, 1, 1f, "A_Squirrel_Eat")); drawComp.AddAnim("Catch", new AnimData(1, 1, 1f, "A_Squirrel_Catch")); child.RegisterComponent(drawComp); drawComp.SetNowAnim("Run"); child.RegisterComponent(new C_UpdateSquirrelState(gameDevice)); }
public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる player = EntityManager.FindWithTag("Player")[0]; childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3"); bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); state = (C_CharaState)entity.GetNormalComponent("C_CharaState"); if (childDirection.IsRight()) { entity.transform.Angle = 330; } else if (childDirection.IsLeft()) { entity.transform.Angle = 210; } else if (childDirection.IsNone()) { entity.transform.Angle = 360; } JumpingMove(); }
public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); }
public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる playerDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3"); bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); state = (C_CharaState)entity.GetNormalComponent("C_CharaState"); animControl = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion"); }
private void CreatWasteland(List <int> lb) { //実体生成 Entity wasteland = Entity.CreateEntity("Wasteland", "Wasteland", new Transform2D()); //位置設定 C_BezierPoint bezier = new C_BezierPoint(); //初期化毒沼 C_UpdateWastelandState wastelandState = new C_UpdateWastelandState(lb); wasteland.RegisterComponent(wastelandState); wasteland.RegisterComponent(new C_DrawWasteland(gameDevice, wastelandState)); }
/// <summary> /// 初期化 /// </summary> public void Initialize() { isEnd = false; resourceLoader.Initialize(); totalResouceNum = resourceLoader.Count; resourceManager.LoadFont("HGPop"); resourceManager.LoadTextures("A_Player_Run", "./IMAGE/Animetions/"); for (int i = 0; i < 4; i++) { resourceManager.LoadTextures("P_Flower_" + i, "./IMAGE/Particles/"); } resourceManager.LoadTextures("P_Rain", "./IMAGE/Particles/"); resourceManager.LoadTextures("P_Leaf", "./IMAGE/Particles/"); resourceManager.LoadEffect("PaticleShader", "./EFFECT/"); resourceManager.LoadEffect("MaskShader", "./EFFECT/"); entity = Entity.CreateEntity("Empty", "Empty", new Transform2D()); entity.transform.Position = new Vector2(startX, 1020); entity.RegisterComponent(new C_Switch3()); C_BezierPoint bezier = new C_BezierPoint(); entity.RegisterComponent(bezier); C_DrawAnimetion drawComp = new C_DrawAnimetion(Vector2.One * 256, 16); drawComp.AddAnim("Run", new AnimData(13, 4, 0.02f, "A_Player_Run")); entity.RegisterComponent(drawComp); drawComp.SetNowAnim("Run"); drawComp.SetSize(0.7f); C_SeasonState season = new C_SeasonState(eSeason.Summer); C_DrawRouteEffect route = new C_DrawRouteEffect(); route.RegisterImage("P_Flower_", 4); route.SetState(0.02f, 10, -85); route.SetAliveSecond(2); route.SetSize(new Vector2(0.5f, 0.5f)); entity.RegisterComponent(season); entity.RegisterComponent(route); }
public static void SetBezierposition(Entity entity) { Vector2 nowPosition = entity.transform.Position; //横スキャンして、リストを取る List <int> indexs = GetIndexList(nowPosition); C_BezierPoint bezierComp = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); int lineIndex = 0; int bezierPoint = 0; int cursor = 0; List <Vector2> route = new List <Vector2>(); object syncObject = new object(); lock (syncObject) { CheckBezierPosition(bezierComp, ref lineIndex, ref bezierPoint, ref cursor, ref route); } bezierComp.SetBezierData(lineIndex, bezierPoint, cursor); bezierComp.SetRoute(route); }
public override void Active() { base.Active(); //TODO 更新コンテナに自分を入れる childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3"); bezierPoint = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint"); childDirection.SetRight(false); if (childDirection.IsRight()) { entity.transform.Angle = 360; } else if (childDirection.IsLeft()) { entity.transform.Angle = 180; } else if (childDirection.IsNone()) { entity.transform.Angle = 360; } }
public void CreatPlayer() { //生成地を決める Transform2D trans = new Transform2D(); trans.Position = new Vector2(500, 100); //実体生成 Entity player = Entity.CreateEntity("Player", "Player", trans); //機能登録(順序注意 - 関連性ある) player.RegisterComponent(new C_Switch3()); player.RegisterComponent(new C_CharaState()); C_BezierPoint bezier = new C_BezierPoint(); player.RegisterComponent(bezier); BezierStage.AddBezierData(bezier); player.RegisterComponent(new C_EntityDeadCheck()); player.RegisterComponent(new C_PlayerState()); player.RegisterComponent(new C_DrawRouteEffect()); //player.RegisterComponent(new C_DrawLocus()); player.RegisterComponent(new C_DrawDebugMessage(gameDevice, bezier)); C_DrawAnimetion drawComp = new C_DrawAnimetion(Vector2.One * 256, 16); drawComp.AddAnim("Idle", new AnimData(1, 1, 1, "A_Player_Idle")); drawComp.AddAnim("Walk", new AnimData(4, 4, 0.12f, "A_Player_Walk")); drawComp.AddAnim("Jump", new AnimData(2, 3, 0.1f, "A_Player_Jump", false)); drawComp.AddAnim("Run", new AnimData(13, 4, 0.05f, "A_Player_Run")); drawComp.AddAnim("Attack", new AnimData(1, 1, 1, "A_Player_Attack")); player.RegisterComponent(drawComp); drawComp.SetNowAnim("Idle"); player.RegisterComponent(new C_Energy("Bar", 10, 270)); player.RegisterComponent(new C_UpdatePlayerState(gameDevice)); }
private static void CheckBezierPosition(C_BezierPoint bezierComp, ref int lineIndex, ref int bezierPoint, ref int cursor, ref List <Vector2> route) { Vector2 nowPosition = bezierComp.GetEntity().transform.Position; //横スキャンして、リストを取る List <int> indexs = GetIndexList(nowPosition); List <List <Vector2> > routes = new List <List <Vector2> >(); //着地できるルートがない場合 if (indexs.Count == 0) { isEnd = true; lineIndex = -1; return; } //着地できるルートは1つしかない場合 else if (indexs.Count == 1) { while (nowPosition.X > controllPoints[indexs[0]][bezierPoint + 2].X) { bezierPoint += 2; } routes.Add(GetNowRoute(indexs[0], bezierPoint)); while (nowPosition.X > routes[0][cursor].X && cursor < routes[0].Count - 1) { int distance = (int)((nowPosition.X - routes[0][cursor].X) * 0.6f); if (distance <= 1) { cursor++; break; } if (routes[0].Count > cursor + distance) { cursor += distance; } else { cursor++; } } lineIndex = indexs[0]; route = routes[0]; return; } //着地できるルートは複数の場合 List <int> cursors = new List <int>(); //ルートの中の位置 List <int> bezierPoints = new List <int>(); //ルート for (int i = 0; i < indexs.Count; i++) { bezierPoint = 0; cursor = 0; //今のlineを登録 if (bezierComp.LineIndex == indexs[i]) { while (nowPosition.X > controllPoints[indexs[i]][bezierPoint + 2].X) { bezierPoint += 2; } routes.Add(GetNowRoute(indexs[i], bezierPoint)); bezierPoints.Add(bezierPoint); while (nowPosition.X > routes[i][cursor].X && cursor < routes[i].Count - 1) { int distance = (int)((nowPosition.X - routes[i][cursor].X) * 0.6f); if (distance <= 1) { cursor++; break; } if (routes[i].Count > cursor + distance) { cursor += distance; } else { cursor++; } } cursors.Add(cursor); continue; } //検索した他のlineを登録 while (nowPosition.X > controllPoints[indexs[i]][bezierPoint + 2].X) { bezierPoint += 2; } routes.Add(GetNowRoute(indexs[i], bezierPoint)); bezierPoints.Add(bezierPoint); //所在位置のx座標のチェック while (nowPosition.X > routes[i][cursor].X && cursor < routes[i].Count - 1) { int distance = (int)((nowPosition.X - routes[i][cursor].X) * 0.6f); if (distance <= 1) { cursor++; break; } if (routes[i].Count > cursor + distance) { cursor += distance; } else { cursor++; } } cursors.Add(cursor); } int index = 0; float lenth = routes[index][cursors[index]].Y - nowPosition.Y; //着地できるルートを全チェック for (int i = 0; i < indexs.Count; i++) { //今の位置はルートの下だとチェックしない if (nowPosition.Y > routes[i][cursors[i]].Y) { continue; } if (lenth < 0) { index = i; lenth = routes[index][cursors[index]].Y - nowPosition.Y; continue; } //チェック中のルートと自分の距離はさっきチェックした最短距離より大きい場合は更新しない if (lenth < routes[i][cursors[i]].Y - nowPosition.Y) { continue; } index = i; lenth = routes[index][cursors[index]].Y - nowPosition.Y; } lineIndex = indexs[index]; bezierPoint = bezierPoints[index]; cursor = cursors[index]; route = routes[index]; }
public static void AddBezierData(C_BezierPoint bezierData) { bezierDatas.Add(bezierData); }