Beispiel #1
0
    /// <summary>
    /// �C���X�y�N�^���GUI��`�悷��
    /// </summary>
    public override void DrawGUI()
    {
        base.DrawGUI();

        fromDirection.DrawGUI();
        speed = UnityEditor.EditorGUILayout.FloatField("Speed", speed);

        var prevTimeFuncType = rotateTimeFuncType;
        rotateTimeFuncType = (TimeFuncBase.FuncType)UnityEditor.EditorGUILayout.EnumPopup("Rotate Function", rotateTimeFuncType);
        if ( rotateTimeFuncType != prevTimeFuncType || rotateTimeFunc == null ) {
            // �^���ύX���ꂽ
            rotateTimeFunc = TimeFuncBase.CreateInstance(rotateTimeFuncType);
        }
        rotateTimeFunc.DrawGUI();

        rotateSpeed = UnityEditor.EditorGUILayout.FloatField("Rotate Speed", rotateSpeed);

        var prevType = targetType;
        targetType = (TargetBase2D.TargetType)UnityEditor.EditorGUILayout.EnumPopup("Target Type", targetType);
        if ( targetType != prevType || target == null ) {
            // �^���ύX���ꂽ
            target = TargetBase2D.CreateInstance(targetType);
        }
        target.DrawGUI();

        lookEnd = UnityEditor.EditorGUILayout.Toggle("Look End", lookEnd);
    }
Beispiel #2
0
    /// <summary>
    /// �f�V���A���C�Y
    /// </summary>
    /// <param name="bytes">�V���A���C�Y�ς݃��[�V�����f�[�^</param>
    /// <param name="offset">���[�V�����f�[�^�̊J�n�ʒu</param>
    /// <returns>�f�V���A���C�Y�Ɏg�p�����o�C�g�T�C�Y��offset����Z�����l</returns>
    public override int Deserialize(byte[] bytes, int offset)
    {
        offset = base.Deserialize(bytes, offset);

        offset = fromDirection.Deserialize(bytes, offset);
        speed = BitConverter.ToSingle(bytes, offset);
        offset += sizeof(float);

        rotateTimeFuncType = (TimeFuncBase.FuncType)BitConverter.ToInt32(bytes, offset);
        offset += sizeof(int);
        rotateTimeFunc = TimeFuncBase.GetDeserialized(rotateTimeFuncType, bytes, offset, out offset);

        rotateSpeed = BitConverter.ToSingle(bytes, offset);
        offset += sizeof(float);
        targetType = (TargetBase2D.TargetType)BitConverter.ToInt32(bytes, offset);
        offset += sizeof(int);
        target = TargetBase2D.GetDeserialized(targetType, bytes, offset, out offset);

        lookEnd = BitConverter.ToBoolean(bytes, offset);
        offset += sizeof(bool);

        return offset;
    }