public Object Frame(int frameTime) { var v = new Vector3(); // var battleModel = GameModelLocator.getInstance().gameModel; // // var ce = battleModel.getClientEntityFormId(id); // // if (ce == null) // { // ce = battleModel.getCurrentSelfClientEntity(); // } // // var angle = ce.lerpAngle.x + battleModel.shakeAngleOffect.x; var battleModel = GameModelLocator.GetInstance().GameModel; PlayerEntity player = SingletonManager.Get <FreeUiManager>().Contexts1.player.GetEntityWithEntityKey(new EntityKey(id, (int)EEntityType.Player)); FreeMoveEntity move = SingletonManager.Get <FreeUiManager>().Contexts1.freeMove.GetEntityWithEntityKey(new EntityKey(id, (int)EEntityType.FreeMove)); //if (player == null && move == null) //{ // player = SingletonManager.Get<FreeUiManager>().Contexts1.player.flagSelfEntity; //} var angle = this._angle; if (player != null) { angle = player.orientation.Yaw + this._angle + battleModel.shakeAngleOffect.x; } var dir = new Vector3(); var end = new Vector3(); FreeMathUtility.AnglesToVector(angle, pitch, ref dir); PositionComponent pos = null; if (player != null) { pos = player.position; } if (move != null) { if (move.hasPosition) { pos = move.position; } } if (pos != null) { FreeMathUtility.Vector3DMA(pos.Value, distance, dir, ref end); v.x = end.x; v.y = end.y + height; v.z = end.z; } else { return(null); } return(v); }
public Object Frame(int frameTime) { var v = new Vector3(); // var battleModel:BattleModel = GameModelLocator.getInstance().gameModel; // var ceS:ClientEntity = battleModel.getClientEntityFormId(source); // var ceT:ClientEntity = battleModel.getClientEntityFormId(target); // // if(ceS == null){ // ceS = battleModel.getCurrentSelfClientEntity(); // } // // if(ceT == null){ // ceT = battleModel.getCurrentSelfClientEntity(); // } var ceS = SingletonManager.Get <FreeUiManager>().Contexts1.player.GetEntityWithEntityKey(new EntityKey(source, (int)EEntityType.Player)); if (ceS == null) { ceS = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity; } var ceT = SingletonManager.Get <FreeUiManager>().Contexts1.player.GetEntityWithEntityKey(new EntityKey(target, (int)EEntityType.Player)); if (ceT == null) { ceT = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity; } var sub = ceT.position.Value - ceS.position.Value; if (toSource) { sub = ceS.position.Value - ceT.position.Value; } var av = new Vector3(); FreeMathUtility.VectorToAngles(sub, ref av); var angle = av.x; var dir = new Vector3(); var end = new Vector3(); var mins = new Vector3(); var maxs = new Vector3(); mins.Set(-10, -10, -10); maxs.Set(10, 10, 10); FreeMathUtility.AnglesToVector(angle, 0, ref dir); if (toSource) { FreeMathUtility.Vector3DMA(ceS.position.Value, distance, dir, ref end); } else { FreeMathUtility.Vector3DMA(ceT.position.Value, distance, dir, ref end); } v.x = end.x; v.y = end.y + height; v.z = end.z; return(v); }