public static void BlowFly(WorldBase world, EntityBase skiller, EntityBase hurter, string blowFlyID) { MoveComponent amc = skiller.GetComp <MoveComponent>(); MoveComponent bmc = hurter.GetComp <MoveComponent>(); Vector3 dir = amc.dir.ToVector(); if (skiller.GetExistComp <SkillStatusComponent>()) { SkillStatusComponent assc = skiller.GetComp <SkillStatusComponent>(); dir = assc.skillDir.ToVector(); } //Debug.Log("BlowFly --> skill id " + skillData.m_key + " blowfly id " + blowFlyID + " skilltoken pos " + amc.pos.ToVector() + " "); if (blowFlyID != "null") { //Debug.Log("BlowFly " + hurter.ID + " skillID " + skillData.m_key); //击飞处理 if (hurter.GetExistComp <BlowFlyComponent>()) { BlowFlyComponent bfc = hurter.GetComp <BlowFlyComponent>(); if (!bfc.isBlow) { bfc.isBlow = true; bfc.blowFlyID = blowFlyID; bfc.blowTime = (int)(bfc.BlowData.m_Time * 1000); bfc.SetBlowFly(amc.pos.ToVector(), bmc.pos.ToVector(), dir); } } } }
public override void BeforeFixedUpdate(int deltaTime) { List <EntityBase> list = GetEntityList(); for (int i = 0; i < list.Count; i++) { CommandComponent com = list[i].GetComp <CommandComponent>(); MoveComponent move = list[i].GetComp <MoveComponent>(); PlayerComponent pc = list[i].GetComp <PlayerComponent>(); LifeComponent lc = list[i].GetComp <LifeComponent>(); BlowFlyComponent blc = list[i].GetComp <BlowFlyComponent>(); if (lc.Life > 0 && !blc.isBlow && !pc.GetIsDizziness()) { pc.faceDir = com.skillDir.DeepCopy(); move.dir = com.moveDir.DeepCopy(); move.m_velocity = pc.GetSpeed(); } else { move.dir.FromVector(Vector3.zero); } } }
void BlowFlyLogic(EntityBase entity, int deltaTime) { BlowFlyComponent bfc = entity.GetComp <BlowFlyComponent>(); if (bfc.isBlow) { bfc.blowTime -= deltaTime; MoveComponent mc = entity.GetComp <MoveComponent>(); float distance = bfc.BlowData.m_Distance; float height = bfc.BlowData.m_Height; float time = bfc.BlowData.m_Time; mc.m_velocity = (int)((distance / time) * 1000); mc.dir = bfc.blowDir; if (bfc.blowTime <= 0) { bfc.isBlow = false; } //Debug.Log("BlowFlyLogic " + entity.ID + " blow dir : " + bfc.blowDir.ToVector() + " mc.m_velocity " + mc.m_velocity + " bfc.blowTime " + bfc.blowTime); } }
public override MomentComponentBase DeepCopy() { BlowFlyComponent mc = new BlowFlyComponent(); mc.blowFlyID = blowFlyID; mc.blowTime = blowTime; mc.blowDir = blowDir.DeepCopy(); return(mc); }
public void BlowFly(EntityBase skiller, EntityBase hurter, SkillDataGenerate skillData) { MoveComponent amc = skiller.GetComp <MoveComponent>(); MoveComponent bmc = hurter.GetComp <MoveComponent>(); PlayerComponent apc = skiller.GetComp <PlayerComponent>(); string blowFlyID = skillData.m_BlowFlyID; if (blowFlyID != "null") { //击飞处理 if (hurter.GetExistComp <BlowFlyComponent>()) { BlowFlyComponent bfc = hurter.GetComp <BlowFlyComponent>(); bfc.blowFlyID = blowFlyID; bfc.blowTime = (int)(bfc.BlowData.m_Time * 1000); bfc.SetBlowFly(amc.pos.ToVector(), bmc.pos.ToVector(), apc.faceDir.ToVector()); } } }
void BlowFlyLogic(EntityBase entity, int deltaTime) { BlowFlyComponent bfc = entity.GetComp <BlowFlyComponent>(); if (bfc.isBlow) { bfc.blowTime -= deltaTime; MoveComponent mc = entity.GetComp <MoveComponent>(); float distance = bfc.BlowData.m_Distance; float height = bfc.BlowData.m_Height; float time = bfc.BlowData.m_Time; mc.m_velocity = (int)((distance / time) * 1000); mc.dir = bfc.blowDir; if (bfc.blowTime <= 0) { bfc.isBlow = false; } } }
public void PlayerJoin(EntityBase entity) { PlayerComponent playerComp = null; if (!entity.GetExistComp <PlayerComponent>()) { playerComp = new PlayerComponent(); playerComp.characterID = "1"; playerComp.nickName = "Test model"; ElementData e1 = new ElementData(); e1.id = 100; e1.num = 10; playerComp.elementData.Add(e1); ElementData e2 = new ElementData(); e2.id = 101; e2.num = 10; playerComp.elementData.Add(e2); ElementData e3 = new ElementData(); e3.id = 102; e3.num = 10; playerComp.elementData.Add(e3); ElementData e4 = new ElementData(); e4.id = 103; e4.num = 00; playerComp.elementData.Add(e4); entity.AddComp(playerComp); } if (!entity.GetExistComp <CommandComponent>()) { CommandComponent c = new CommandComponent(); entity.AddComp(c); } if (!entity.GetExistComp <TransfromComponent>()) { TransfromComponent c = new TransfromComponent(); entity.AddComp(c); } if (!entity.GetExistComp <AssetComponent>()) { AssetComponent c = new AssetComponent(); c.m_assetName = "famale_01"; entity.AddComp(c); } if (!entity.GetExistComp <MoveComponent>()) { MoveComponent c = new MoveComponent(); c.pos.FromVector(new Vector3(15, 0, 0)); entity.AddComp(c); } if (!entity.GetExistComp <SkillStatusComponent>()) { SkillStatusComponent c = new SkillStatusComponent(); DataTable data = DataManager.GetData("SkillData"); for (int i = 0; i < data.TableIDs.Count; i++) { c.m_skillList.Add(new SkillData(data.TableIDs[i], i)); } entity.AddComp(c); } if (!entity.GetExistComp <CDComponent>()) { CDComponent c = new CDComponent(); entity.AddComp(c); } if (!entity.GetExistComp <CampComponent>()) { CampComponent c = new CampComponent(); c.creater = entity.ID; entity.AddComp(c); } if (!entity.GetExistComp <MoveComponent>()) { MoveComponent c = new MoveComponent(); entity.AddComp(c); } if (!entity.GetExistComp <CollisionComponent>()) { CollisionComponent c = new CollisionComponent(); c.area.areaType = AreaType.Circle; c.area.radius = 0.5f; entity.AddComp(c); } if (!entity.GetExistComp <LifeComponent>()) { LifeComponent c = new LifeComponent(); c.maxLife = playerComp.CharacterData.m_hp; c.life = playerComp.CharacterData.m_hp; entity.AddComp(c); } if (!entity.GetExistComp <BlowFlyComponent>()) { BlowFlyComponent c = new BlowFlyComponent(); entity.AddComp(c); } }
public void PlayerJoin(EntityBase entity) { ConnectionComponent connectComp = entity.GetComp <ConnectionComponent>(); PlayerComponent playerComp = null; if (!entity.GetExistComp <PlayerComponent>()) { playerComp = new PlayerComponent(); entity.AddComp(playerComp); } else { playerComp = entity.GetComp <PlayerComponent>(); } //将角色ID传入游戏 playerComp.characterID = connectComp.m_session.player.characterID; playerComp.nickName = connectComp.m_session.player.playerID; ElementData e1 = new ElementData(); e1.id = 100; e1.num = 10; playerComp.elementData.Add(e1); ElementData e2 = new ElementData(); e2.id = 101; e2.num = 10; playerComp.elementData.Add(e2); ElementData e3 = new ElementData(); e3.id = 102; e3.num = 10; playerComp.elementData.Add(e3); ElementData e4 = new ElementData(); e4.id = 103; e4.num = 00; playerComp.elementData.Add(e4); if (!entity.GetExistComp <CommandComponent>()) { CommandComponent c = new CommandComponent(); entity.AddComp(c); } if (!entity.GetExistComp <TransfromComponent>()) { TransfromComponent c = new TransfromComponent(); c.pos.FromVector(new Vector3(15, 0, 0)); entity.AddComp(c); } if (!entity.GetExistComp <AssetComponent>()) { AssetComponent c = new AssetComponent(); c.m_assetName = playerComp.CharacterData.m_ModelID; entity.AddComp(c); } if (!entity.GetExistComp <MoveComponent>()) { MoveComponent c = new MoveComponent(); c.pos.FromVector(new Vector3(15, 0, 0)); entity.AddComp(c); } if (!entity.GetExistComp <SkillStatusComponent>()) { SkillStatusComponent c = new SkillStatusComponent(); DataTable data = DataManager.GetData("SkillData"); for (int i = 0; i < data.TableIDs.Count; i++) { c.m_skillList.Add(new SkillData(data.TableIDs[i], i)); } entity.AddComp(c); } if (!entity.GetExistComp <CDComponent>()) { CDComponent c = new CDComponent(); entity.AddComp(c); } if (!entity.GetExistComp <CampComponent>()) { CampComponent c = new CampComponent(); c.creater = entity.ID; entity.AddComp(c); } if (!entity.GetExistComp <MoveComponent>()) { MoveComponent c = new MoveComponent(); entity.AddComp(c); } if (!entity.GetExistComp <CollisionComponent>()) { CollisionComponent c = new CollisionComponent(); c.area.areaType = AreaType.Circle; c.area.radius = 0.5f; entity.AddComp(c); } if (!entity.GetExistComp <LifeComponent>()) { LifeComponent c = new LifeComponent(); c.maxLife = playerComp.CharacterData.m_hp; c.life = playerComp.CharacterData.m_hp; entity.AddComp(c); } if (!entity.GetExistComp <BlowFlyComponent>()) { BlowFlyComponent c = new BlowFlyComponent(); entity.AddComp(c); } //预测一个输入 //TODO 放在框架中 if (entity.GetExistComp <ConnectionComponent>()) { ConnectionComponent cc = entity.GetComp <ConnectionComponent>(); cc.m_lastInputCache = new CommandComponent(); cc.m_defaultInput = new CommandComponent(); } GameTimeComponent gtc = m_world.GetSingletonComp <GameTimeComponent>(); gtc.GameTime = 10000 * 1000; }