//スケールの変更 void ChangeScale() { size = GetComponent <ObjectSize>().GetSize(); //ミラーサイズの取得 changeScale.SetMirrorSize(GetComponent <ObjectSize>().GetReflectSize()); ////// Vector3 targetScale = changeScale.Scale(hitMirror, size); scale = Lerp(scale, targetScale); ////// //Vector3 targetScale = changeScale.Scale(hitMirror, size); //scale = Lerp2(scaleStorage, targetScale); //Vector3 scale = changeScale.Scale(hitMirror, size/*mirrorRect, transform.position*/); //サイズの変更 transform.localScale = Vector3.Scale(scale, normalScale); //transform.localScale = Vector3.Scale(scale, normalScale); //質量の変更 GetComponent <Rigidbody>().mass = scale.x * scale.y * normalMass; ////ミラーサイズの取得 //changeScale.SetMirrorSize(GetComponent<ObjectSize>().GetReflectSize()); //Vector3 scale = changeScale.Scale(change, size/*mirrorRect, transform.position*/); ////サイズの変更 //transform.localScale = Vector3.Scale(scale, normalScale); ////質量の変更 //GetComponent<Rigidbody>().mass = scale.x * scale.y * normalMass; }
public static Problem Get(ProblemEnmu problemEnmu, SizeEnum sizeEnum) { switch (problemEnmu) { case ProblemEnmu.ReverseWords: return(new ReverseWords.Problem() { FileName = string.Format("ReverseWords\\B-{0}-practice", sizeEnum) }); case ProblemEnmu.StoreCredit: return(new StoreCredit.Problem() { FileName = string.Format("StoreCredit\\A-{0}-practice", sizeEnum) }); case ProblemEnmu.Rotate: return(new Rotate.Problem() { FileName = string.Format("Rotate\\A-{0}-practice", sizeEnum) }); default: throw new NotImplementedException(); } }
public static void SetupGameFont(string xFontFamily, SizeEnum size) { generalFontFamily = xFontFamily; switch (size) { case SizeEnum.Small: generalFontSize = 6; break; case SizeEnum.Medium: generalFontSize = 8; break; case SizeEnum.Large: generalFontSize = 10; break; default: generalFontSize = 8; break; } SetupPlayerGameFont("Arial", 24); generalFont = new Font(generalFontFamily, generalFontSize); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Node = binaryReader.ReadShortBlockIndex1(); this.Region = binaryReader.ReadShortBlockIndex1(); this.Permutattion = binaryReader.ReadShortBlockIndex2(); this.fieldpad = binaryReader.ReadBytes(2); this.BoudingSphereOffset = binaryReader.ReadVector3(); this.BoundingSphereRadius = binaryReader.ReadSingle(); this.RigidBodiesFlags = ((Flags)(binaryReader.ReadInt16())); this.MotionType = ((MotionTypeEnum)(binaryReader.ReadInt16())); this.NoPhantomPowerAlt = binaryReader.ReadShortBlockIndex1(); this.Size = ((SizeEnum)(binaryReader.ReadInt16())); this.InertiaTensorScale = binaryReader.ReadSingle(); this.LinearDamping = binaryReader.ReadSingle(); this.AngularDamping = binaryReader.ReadSingle(); this.CenterOffMassOffset = binaryReader.ReadVector3(); this.ShapeType = ((ShapeTypeEnum)(binaryReader.ReadInt16())); this.Shape = binaryReader.ReadShortBlockIndex2(); this.Mass = binaryReader.ReadSingle(); this.CenterOfMass = binaryReader.ReadVector3(); this.fieldskip = binaryReader.ReadBytes(4); this.IntertiaTensorX = binaryReader.ReadVector3(); this.fieldskip0 = binaryReader.ReadBytes(4); this.IntertiaTensorY = binaryReader.ReadVector3(); this.fieldskip1 = binaryReader.ReadBytes(4); this.IntertiaTensorZ = binaryReader.ReadVector3(); this.fieldskip2 = binaryReader.ReadBytes(4); this.BoundingSpherePad = binaryReader.ReadSingle(); this.fieldpad0 = binaryReader.ReadBytes(12); return(pointerQueue); }
/// <summary> /// Sets the size of the corresponding element type. /// </summary> public void SetSize(SizeEnum size) { if (this.metadata.IsFinalized) { throw new InvalidOperationException("Already finalized!"); } this.size = new ConstValue <SizeEnum>(size); }
void ChangeScale() { if (tag == "reflect") { return; } SizeEnum size = GetComponent <ObjectSize>().GetSize(); //transform.localScale = changeScale.Scale(size/*new Vector2(transform.position.x, transform.position.y)*/); }
//Collections of methods related to setting up components of the game. //Setups format manager that is used to store how text should be drawn. //SetupBoard used to creating the game board and spaces. //Setups a timer that checks for refresh messagse from the server. private void SetupGame(SizeEnum size) { FormatManager.SetupFormatManager(size); SetupBoard(size); timer.SetupGameTimer(UpdateFromServer); GetSpacesFromServer(); CreatePlayer(); GetCurrentPlayer(); players = GetPlayersFromServer(); camera.centerOnGameObject(board.GetStartingSpace()); }
// Use this for initialization void Start() { audio = GetComponent <AudioSource>(); seManager = GetComponent <SEManager>(); changeScale = new ChangeScale(new Vector3(1, 1, 1), changeTime); //mirrorRect = new Rect(1, 1, 1, 1); normalScale = transform.localScale; scale = new Vector3(1, 1, 1);//transform.localScale; scaleStorage = scale; normalMass = GetComponent <Rigidbody>().mass; sizeStorage = SizeEnum.Normal; }
/// <summary> /// 映す像を追加する処理 /// </summary> /// <param name="origin">映し元</param> /// <param name="unresizable">大きさ変えられるか</param> private void AddReflectObj(GameObject origin, bool unresizable) { Vector3 dest_size = ReflectSize(unresizable); //サイズ指定 GameObject reflect = Instantiate(origin, reflectParent); //像のObjectを生成 DestroyChildCompo(ref reflect); //子供のコンポーネントを削除 SizeEnum reflectSize = unresizable ? SizeEnum.Normal : sizeEnum; reflect.AddComponent <ReflectObject>(); //像のコンポーネント追加 reflect.GetComponent <ReflectObject>().ReflectFrom(origin, dest_size, reflectSize); //映し元とサイズ設定 reflectObj.Add(reflect); //管理リストに追加 }
void ChangeCollider() { SizeEnum size = transform.GetComponent <ObjectSize>().GetSize(); if (size == SizeEnum.Big_XY || size == SizeEnum.Big_Y) { transform.GetComponent <BoxCollider>().isTrigger = true; } else { transform.GetComponent <BoxCollider>().isTrigger = false; } }
/// <summary> /// 显示 Modal /// </summary> /// <param name="value">Child 对象</param> /// <param name="caption">标题</param> /// <param name="button">按钮</param> public void ShowContext(TContext value, string caption = null, SizeEnum sizeEnum = SizeEnum.Default, List <ContextAction> buttons = null, Action <object> onClose = null) { DataContext.Caption = caption ?? value?.Caption; DataContext.SizeEnum = sizeEnum; DataContext.ResetAction(); if (buttons != null) { DataContext.ContextActions.AddRange(buttons); } DataContext.Child = value; DataContext.OnClosed = onClose; Show(); }
public static void SetSizeMultiplier(SizeEnum size) { if (size == SizeEnum.Large) { sizeMultiplier = 1; } else if (size == SizeEnum.Medium) { sizeMultiplier = 0.75; } else { sizeMultiplier = 0.50; } }
public int GetPrice(SizeEnum size) { switch (size) { case SizeEnum.Small: return(BasePrice); case SizeEnum.Medium: return((int)Math.Ceiling(BasePrice * 1.2)); case SizeEnum.Large: return((int)Math.Ceiling(BasePrice * 1.4)); default: return((int)Math.Ceiling(BasePrice * 1.2)); } }
public int GetPrice(SizeEnum size) { switch (size) { case SizeEnum.Small: return(_price); case SizeEnum.Medium: return((int)Math.Ceiling(_price * 1.2)); case SizeEnum.Large: return((int)Math.Ceiling(_price * 1.4)); default: throw new ArgumentException($"We do not have specified price for this size {size.ToString()}"); } }
/// <summary> /// どのObjを反映するか /// </summary> /// <param name="originObj">映し元</param> /// <param name="size">拡大・縮小のサイズ</param> public void ReflectFrom(GameObject originObj, Vector3 size, SizeEnum sizeEnum) { gameObject.layer = 8; this.originObj = originObj; this.size = sizeEnum; reflectSize = originObj.transform.localScale; //映し元のサイズ指定 ObjectSize objSize = originObj.GetComponent <ObjectSize>(); if (objSize) { reflectSize = objSize.DefaultSize(); } reflectSize.Scale(size); //拡大縮小したサイズ sizeRate = size; InitMeshRenderer(); }
//オブジェクトの変形 public Vector3 Scale(bool hitMirror, SizeEnum size) { //if (size == SizeEnum.Normal && !isChange) return new Vector3(1, 1, 1); if (hitMirror) { isChange = true; timer = changeTime; } if (isChange) { TimerUpdate(); return(mirrorSize); } else { return(new Vector3(1, 1, 1)); } }
private void SetupGame(SizeEnum size) { FormatManager.SetupFormatManager(size); SetupBoard(size); totalTimeElapsed = 0; timer.SetupGameTimer(RecordTime); camera.centerOnGameObject(gameObjects[4]); //Generate players players = new List <Player>(1) { new Player(0, board.GetStartingSpace(), Color.Red), new Player(1, board.GetStartingSpace(), Color.Blue), new Player(2, board.GetStartingSpace(), Color.Green), new Player(3, board.GetStartingSpace(), Color.Yellow) }; currentPlayer = 0; gameObjects.AddRange(players); }
/// <summary> /// 小さいか /// </summary> /// <param name="size">エネミーのサイズ</param> /// <returns></returns> private bool IsSmall(ObjectSize size) { SizeEnum eSize = size.GetSize(); if (eSize == SizeEnum.Small_XY) { return(true); } //全体的に小さいか if (eSize == SizeEnum.Small_X) { return(true); } //横に縮んでいるか if (eSize == SizeEnum.Small_Y) { return(true); } //縦に縮んでいるか return(false); //縮んでいない。 }
// Update is called once per frame void Update() { if (tag == "reflect") { return; } ChangeScale(); //保存したサイズと同じならリターン if (size == sizeStorage) { return; } //サイズの保存 sizeStorage = size; //hitMirrorの保存 hitMirrorStorage = hitMirror; //サイズに応じたSEの再生 PlaySE(size); }
private void PlaySE(SizeEnum size) { if (size == SizeEnum.Normal) { audio.clip = seManager.GetSE(0); audio.Play(); //Debug.Log("normalSE"); } else if (size <= SizeEnum.Big_XY) { audio.clip = seManager.GetSE(1); audio.Play(); //Debug.Log("BigSE"); } else { audio.clip = seManager.GetSE(2); audio.Play(); //Debug.Log("SmallSE"); } }
public List <SizeEnum.Size> GetSizeOptions() { var sizes = new List <SizeEnum.Size>(); using (var connection = new MySqlConnection(_connectionString)) { connection.Open(); string query = "SELECT SizeName FROM Size;"; MySqlCommand cmd = connection.CreateCommand(); cmd.CommandText = query; MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { sizes.Add(SizeEnum.GetSize((string)dataReader["SizeName"])); } return(sizes); } }
public FileJob(IFile sourceFile, string fromPath, string pendingPath, string toPath, ModeEnum mode, string password, string salt) : base(fromPath, pendingPath, toPath) { if (mode == ModeEnum.Undefinied) { throw new ArgumentOutOfRangeException("mode"); } _Mode = mode; _Password = password; _Salt = salt; _SourceFile = sourceFile; SizeEnum size = GetSize(); switch (size) { case SizeEnum.Undefinied: throw new Exception(); case SizeEnum.Small: _CompressToMemory = true; _EncryptToMemory = true; break; case SizeEnum.Medium: _CompressToMemory = false; _EncryptToMemory = true; break; case SizeEnum.Large: _CompressToMemory = false; _EncryptToMemory = false; break; default: throw new Exception(); } }
/// <summary> /// Makes a damage on the owner of this biometrics based on the given damage type and value. /// </summary> /// <param name="damageType">The type of the damage.</param> /// <param name="damageValue">The amount of the damage.</param> /// <param name="isFriendlyDamage">This flag indicates whether this is a friendly damage or not.</param> public void Damage(DamageTypeEnum damageType, int damageValue, bool isFriendlyDamage) { if (this.owner.Read().ElementType.Size == null) { throw new InvalidOperationException("Unable to make damage on non-attackable entities!"); } if (this.owner.Read().ElementType.Armor == null) { throw new InvalidOperationException("Unable to make damage on non-attackable entities!"); } if (this.hp.Read() == -1) { throw new InvalidOperationException("Unable to make damage on non-attackable entities!"); } SizeEnum size = this.owner.Read().ElementType.Size.Read(); int armor = this.owner.Read().ElementType.Armor.Read(); RCNumber finalDamage = Math.Max(0, damageValue - armor) * DAMAGE_EFFECTIVENESS_TABLE[Tuple.Create(damageType, size)]; if (finalDamage < (RCNumber)1 / (RCNumber)2) { finalDamage = (RCNumber)1 / (RCNumber)2; } RCNumber newHP = this.hp.Read() - finalDamage; if (newHP < 0) { newHP = 0; } this.hp.Write(newHP); if (!isFriendlyDamage) { this.frameIndexOfLastEnemyDamage.Write(this.owner.Read().Scenario.CurrentFrameIndex); } }
public static void SetupFormatManager(SizeEnum size) { SetSizeMultiplier(size); SetupGameFont("Arial", size); }
/** * <summary>Gets the page size of the given format, portrait orientation.</summary> * <param name="size">Page size.</param> */ public static Size GetSize( SizeEnum size ) { return(GetSize(size, OrientationEnum.Portrait)); }
/** * <summary>Gets the page size of the given format and orientation.</summary> * <param name="size">Page size.</param> * <param name="orientation">Page orientation.</param> */ public static Size GetSize( SizeEnum size, OrientationEnum orientation ) { int width, height = 0; // Size. { string sizeName = size.ToString(); Match match = IsoSeriesSizePattern.Match(sizeName); // Is it an ISO standard size? if (match.Success) { int baseWidth, baseHeight = 0; string isoSeriesSize = match.Groups[1].Value; if (isoSeriesSize.Equals(IsoSeriesSize_A)) { baseWidth = 2384; baseHeight = 3370; } else if (isoSeriesSize.Equals(IsoSeriesSize_B)) { baseWidth = 2834; baseHeight = 4008; } else if (isoSeriesSize.Equals(IsoSeriesSize_C)) { baseWidth = 2599; baseHeight = 3676; } else { throw new NotImplementedException("Paper format " + size + " not supported yet."); } int isoSeriesSizeIndex = Int32.Parse(match.Groups[2].Value); double isoSeriesSizeFactor = 1 / Math.Pow(2, isoSeriesSizeIndex / 2d); width = (int)Math.Floor(baseWidth * isoSeriesSizeFactor); height = (int)Math.Floor(baseHeight * isoSeriesSizeFactor); } else // Non-ISO size. { switch (size) { case SizeEnum.ArchA: width = 648; height = 864; break; case SizeEnum.ArchB: width = 864; height = 1296; break; case SizeEnum.ArchC: width = 1296; height = 1728; break; case SizeEnum.ArchD: width = 1728; height = 2592; break; case SizeEnum.ArchE: width = 2592; height = 3456; break; case SizeEnum.AnsiA: case SizeEnum.Letter: width = 612; height = 792; break; case SizeEnum.AnsiB: case SizeEnum.Tabloid: width = 792; height = 1224; break; case SizeEnum.AnsiC: width = 1224; height = 1584; break; case SizeEnum.AnsiD: width = 1584; height = 2448; break; case SizeEnum.AnsiE: width = 2448; height = 3168; break; case SizeEnum.Legal: width = 612; height = 1008; break; case SizeEnum.Executive: width = 522; height = 756; break; case SizeEnum.Statement: width = 396; height = 612; break; default: throw new NotImplementedException("Paper format " + size + " not supported yet."); } } } // Orientation. switch (orientation) { case OrientationEnum.Portrait: return(new Size(width, height)); case OrientationEnum.Landscape: return(new Size(height, width)); default: throw new NotImplementedException("Orientation " + orientation + " not supported yet."); } }
//Creates a new board and adds it and its spaces to the gameobjects list. private void SetupBoard(SizeEnum size) { board = new GameBoard(0, 0, Color.Blue, new Size(2048, 2048)); gameObjects.Add(board); gameObjects.AddRange(board.GetBoardSpaces()); }
/** <summary>Gets the page size of the given format and orientation.</summary> <param name="size">Page size.</param> <param name="orientation">Page orientation.</param> */ public static Size GetSize( SizeEnum size, OrientationEnum orientation ) { int width, height = 0; // Size. { string sizeName = size.ToString(); Match match = IsoSeriesSizePattern.Match(sizeName); // Is it an ISO standard size? if(match.Success) { int baseWidth, baseHeight = 0; string isoSeriesSize = match.Groups[1].Value; if(isoSeriesSize.Equals(IsoSeriesSize_A)) {baseWidth = 2384; baseHeight = 3370;} else if(isoSeriesSize.Equals(IsoSeriesSize_B)) {baseWidth = 2834; baseHeight = 4008;} else if(isoSeriesSize.Equals(IsoSeriesSize_C)) {baseWidth = 2599; baseHeight = 3676;} else {throw new NotImplementedException("Paper format " + size + " not supported yet.");} int isoSeriesSizeIndex = Int32.Parse(match.Groups[2].Value); double isoSeriesSizeFactor = 1 / Math.Pow(2,isoSeriesSizeIndex/2d); width = (int)Math.Floor(baseWidth * isoSeriesSizeFactor); height = (int)Math.Floor(baseHeight * isoSeriesSizeFactor); } else // Non-ISO size. { switch(size) { case SizeEnum.ArchA: width = 648; height = 864; break; case SizeEnum.ArchB: width = 864; height = 1296; break; case SizeEnum.ArchC: width = 1296; height = 1728; break; case SizeEnum.ArchD: width = 1728; height = 2592; break; case SizeEnum.ArchE: width = 2592; height = 3456; break; case SizeEnum.AnsiA: case SizeEnum.Letter: width = 612; height = 792; break; case SizeEnum.AnsiB: case SizeEnum.Tabloid: width = 792; height = 1224; break; case SizeEnum.AnsiC: width = 1224; height = 1584; break; case SizeEnum.AnsiD: width = 1584; height = 2448; break; case SizeEnum.AnsiE: width = 2448; height = 3168; break; case SizeEnum.Legal: width = 612; height = 1008; break; case SizeEnum.Executive: width = 522; height = 756; break; case SizeEnum.Statement: width = 396; height = 612; break; default: throw new NotImplementedException("Paper format " + size + " not supported yet."); } } } // Orientation. switch(orientation) { case OrientationEnum.Portrait: return new Size(width,height); case OrientationEnum.Landscape: return new Size(height,width); default: throw new NotImplementedException("Orientation " + orientation + " not supported yet."); } }
/** <summary>Gets the page size of the given format, portrait orientation.</summary> <param name="size">Page size.</param> */ public static Size GetSize( SizeEnum size ) { return GetSize(size,OrientationEnum.Portrait); }
public void SetSize(SizeEnum size) { this.size = size; }
private static Cake CreateCake(SizeEnum size, int numberOfCandles, string customText) { return(new Cake(size, numberOfCandles, customText)); }
private void OptionalVariableField(SerializedProperty settings, string variablename, GUIContent label, bool useBytes = true) { const int k_FieldSpacing = 2; if (s_Styles == null) { s_Styles = new Styles(); } var prop = settings.FindPropertyRelative(variablename); var defaultValueProp = m_DefaultMemorySettingsProperty.FindPropertyRelative(variablename); var overrideText = new GUIContent(string.Empty, "Override Default"); var toggleSize = EditorStyles.toggle.CalcSize(overrideText); var enumValue = SizeEnum.MB; var sizeEnumWidth = EditorStyles.popup.CalcSize(GUIContent.Temp(enumValue.ToString())).x; var minWidth = EditorGUI.indent + EditorGUIUtility.labelWidth + EditorGUI.kSpacing + toggleSize.x + EditorGUI.kSpacing + EditorGUIUtility.fieldWidth + EditorGUI.kSpacing + sizeEnumWidth; var rect = GUILayoutUtility.GetRect(minWidth, EditorGUIUtility.singleLineHeight + k_FieldSpacing); rect.height -= k_FieldSpacing; rect = EditorGUI.IndentedRect(rect); var indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; var labelRect = rect; labelRect.width = EditorGUIUtility.labelWidth; GUI.Label(labelRect, label); var toggleRect = rect; toggleRect.xMin = labelRect.xMax + EditorGUI.kSpacing; toggleRect.size = toggleSize; var useDefault = prop.intValue < 0; var newuseDefault = GUI.Toggle(toggleRect, useDefault, overrideText, Styles.lockButton); var fieldRect = rect; fieldRect.xMin = toggleRect.xMax + EditorGUI.kSpacing; fieldRect.xMax = Mathf.Max(fieldRect.xMax - sizeEnumWidth - EditorGUI.kSpacing, fieldRect.xMin + EditorGUIUtility.fieldWidth); var defaultValue = defaultValueProp.intValue; var sizeEnumRect = rect; sizeEnumRect.xMin = fieldRect.xMax + EditorGUI.kSpacing; sizeEnumRect.width = sizeEnumWidth; if (newuseDefault != useDefault) { if (!newuseDefault) { var result = EditorUtility.DisplayDialog(Styles.warningDialogTitle, Styles.warningDialogText, Styles.okDialogButton, Styles.cancelDialogButton, DialogOptOutDecisionType.ForThisSession, kWarningDialogSessionKey); if (!result) { newuseDefault = true; } } prop.intValue = newuseDefault ? -1 : defaultValue; } if (newuseDefault) { using (new EditorGUI.DisabledScope(true)) { int displayValue = defaultValue; if (useBytes) { enumValue = SizeEnum.B; if ((defaultValue % (1024 * 1024)) == 0) { enumValue = SizeEnum.MB; displayValue /= 1024 * 1024; } else if ((defaultValue % 1024) == 0) { enumValue = SizeEnum.KB; displayValue /= 1024; } } EditorGUI.IntField(fieldRect, displayValue); if (useBytes) { EditorGUI.EnumPopup(sizeEnumRect, enumValue); } } } else { int factor = 1; enumValue = SizeEnum.B; int oldIntValue = prop.intValue; if (useBytes) { if ((oldIntValue % (1024 * 1024)) == 0) { factor = 1024 * 1024; enumValue = SizeEnum.MB; } else if ((oldIntValue % 1024) == 0) { factor = 1024; enumValue = SizeEnum.KB; } } var newIntValue = factor * EditorGUI.DelayedIntField(fieldRect, oldIntValue / factor); if (useBytes) { SizeEnum newEnumValue = (SizeEnum)EditorGUI.EnumPopup(sizeEnumRect, enumValue); if (newEnumValue != enumValue) { if (newEnumValue == SizeEnum.MB) { if (enumValue == SizeEnum.KB) { newIntValue *= 1024; } else { newIntValue *= 1024 * 1024; } } if (newEnumValue == SizeEnum.KB) { if (enumValue == SizeEnum.MB) { newIntValue /= 1024; } else { newIntValue *= 1024; } } if (newEnumValue == SizeEnum.B) { if (enumValue == SizeEnum.MB) { newIntValue /= 1024 * 1024; } else { newIntValue /= 1024; } } } } prop.intValue = newIntValue; } EditorGUI.indentLevel = indent; }