/// <summary> /// Instantiates a new instance of <see cref="FieldAttribute">FieldAttribute</see> defining a member as a simple field. /// </summary> /// <param name="name">Name of the field in the storage device to use for the member marked up by this <see cref="FieldAttribute">FieldAttribute</see>.</param> /// <param name="behavior"><see cref="FieldBehavior">FieldBehavior</see> to use for this member.</param> /// <param name="defaultValue">Default value to use in persisting this member to the storage device if no value is defined.</param> /// <param name="allowNull">Allows or disallows null values during insert and updates.</param> public FieldAttribute( string name, FieldBehavior behavior, object defaultValue, bool allowNull ) : base() { this.Name = name; this.Behavior = behavior; this.DefaultValue = defaultValue; this.AllowNull = allowNull; }
// Use this for initialization public void Start() { _players = new List <PlayerBehavior>(); _activeTetrominoByPlayer = new Dictionary <PlayerBehavior, TetrominoBehavior>(); _tetrominoFactory = TetrominoFactory.GetComponent <TetrominoFactoryBehavior>(); _field = Field.GetComponent <FieldBehavior>(); _timeToNextTetrominoDropInSeconds = TimeBetweenTetriminoDropsInSeconds; }
// Start is called before the first frame update void Start() { fieldBehavior = new FieldBehavior(Width, Height); cursorX = Width / 2; cursorY = Height - 2; cursor = GameObject.FindGameObjectWithTag("Cursor"); comboText = GameObject.FindGameObjectWithTag("ComboText"); fieldBehavior.onInstantiateBlock += (id) => { var instance = Instantiate(blockPrefab); instance.name = "Block" + id; return(instance); }; fieldBehavior.onDeleteBlock += blockObject => { Destroy(blockObject.gameObject); }; fieldBehavior.onCombo += (comboCount, chainCount) => { Debug.Log("連鎖数:" + comboCount); // 連鎖数の表示 if (comboCount >= 2) { var text = comboText.GetComponent <Text>(); text.gameObject.SetActive(true); text.text = string.Format("{0} Combo!", comboCount); } }; fieldBehavior.onComboReset += () => { var text = comboText.GetComponent <Text>(); text.gameObject.SetActive(false); Debug.Log("連鎖リセット"); }; fieldBehavior.Init(); cursor.transform.position = new Vector3(cursorX, Height - 1 - cursorY); }
/// <summary> /// Instantiates a <see cref="T:ReferenceAttribute"/> defining an object member as a reference field. /// </summary> /// <param name="name">Name of field to store the Reference value ( either <see cref="T:Integer"/> value /// from an <see cref="T:Enum"/> or the Primary Key from an <see cref="T:Object"/>).</param> /// <param name="behavior"><see cref="T:FieldBehavior"/> to use for this member.</param> public StaticReferenceAttribute( string name, FieldBehavior behavior ) : base(name, behavior) { base.IsStatic = true; this.MappingType = FieldMappingType.Reference; }
// Use this for initialization public void Start() { _field = FindObjectOfType <FieldBehavior>(); }
/// <summary> /// Instantiates a new instance of <see cref="FieldAttribute">FieldAttribute</see> defining a member as a simple field. /// </summary> /// <param name="name">Name of the field in the storage device to use for the member marked up by this <see cref="FieldAttribute">FieldAttribute</see>.</param> /// <param name="behavior"><see cref="FieldBehavior">FieldBehavior</see> to use for this member.</param> public FieldAttribute( string name, FieldBehavior behavior ) : this(name, behavior, DBNull.Value, true) { }
/// <summary> /// Instantiates a <see cref="T:ReferenceAttribute"/> defining an object member as a reference field. /// </summary> /// <param name="name">Name of field to store the Reference value ( either <see cref="T:Integer"/> value /// from an <see cref="T:Enum"/> or the Primary Key from an <see cref="T:Object"/>).</param> /// <param name="behavior"><see cref="T:FieldBehavior"/> to use for this member.</param> public ReferenceAttribute( string name, FieldBehavior behavior ) : this(name, behavior, false) { }
/// <summary> /// Sets the <see cref="T:FieldBehavior"/> of the child. /// </summary> /// <param name="behavior"><see cref="T:FieldBehavior"/> to use.</param> /// <returns><see cref="T:PersistentFieldMap"/></returns> public PersistentFieldMap WithBehavior( FieldBehavior behavior ) { this.Behavior = behavior; return ( this ); }